简体   繁体   English

使用 Google 表格统计数据集

[英]Using Google sheets to tally data sets

I have tried many formulas but i am still not able to get what i want.我已经尝试了很多公式,但我仍然无法得到我想要的。 I need help to write an APP SCRIPT code for it.我需要帮助为它编写一个 APP 脚本代码。 The problem is that I have to match two data sets and return the value of the adjacent cell.问题是我必须匹配两个数据集并返回相邻单元格的值。 I want the sheet to pick a value from first cell of first row from a sheet and match it to entire cells of a row from other sheet (in the same workbook) and then paste the value which was being matched, infront of the cell which matches it.我希望工作表从工作表的第一行的第一个单元格中选择一个值,并将其与其他工作表(在同一工作簿中)的一行的整个单元格匹配,然后将匹配的值粘贴到单元格的前面匹配它。 Now the problem is that my data sets are not equal so i can not use vlookup, i want to match and how much percentage it is matching.现在的问题是我的数据集不相等所以我不能使用 vlookup,我想匹配它匹配的百分比。 So highest percentage should be considered as a match.所以最高百分比应该被视为匹配。 Kindly visit this link for an example in google sheet.请访问此链接以获取谷歌表中的示例。 [ https://docs.google.com/spreadsheets/d/1u_-64UvpirL2JHpgA--GDa263wVb2idIhIYZlFnX2xQ/edit?usp=sharing] [ https://docs.google.com/spreadsheets/d/1u_-64UvpirL2JHpgA--GDa263wVb2idIhIYZlFnX2xQ/edit?usp=sharing]

There are a variety of ways to do this sort of partial matching, depending on the real data and how sophisticated you need to match logic to be.有多种方法可以进行这种部分匹配,具体取决于真实数据以及匹配逻辑所需的复杂程度。

Let's start with the simplest solution first.让我们先从最简单的解决方案开始。 Did you know you can use wildcards in VLOOKUP ?您知道可以在VLOOKUP使用通配符吗? See Vlookup in Google Sheets using wildcards for partial matches .请参阅使用通配符进行部分匹配的 Google 表格中的 Vlookup

So for your example data, add a column C to "Set 1" with the formula:因此,对于您的示例数据,使用公式将列 C 添加到“设置 1”:

=VLOOKUP("*" & A2 & "*",'Set 2'!A1:A5,1,FALSE)

Obviously, this method fails if "Baseball bat" was supposed the be results for "Ball" instead of "Ballroom".显然,如果“棒球棒”被认为是“球”而不是“舞厅”的结果,则此方法将失败。 VLOOKUP will simply return the first result that matches. VLOOKUP将简单地返回匹配的第一个结果。 This method also ignores case sensitivity.此方法也忽略区分大小写。 Finally, this method only works for appending data to set 1 from set 2, not the other way around.最后,此方法仅适用于将数据附加到 set 2 中的 set 1,而不适用于相反的方法。 Without knowing more about the actual dataset, it's hard to give a solid solution.在不了解实际数据集的情况下,很难给出可靠的解决方案。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM