计算Google电子表格中多列中单词的出现次数

时间:2013-03-12 20:38:57

标签: spreadsheet google-sheets ranking

我有一个这样的电子表格,其中值A-E是来自表单的相同选项:

+------+------+------+
| Opt1 | Opt2 | Opt3 |
+------+------+------+
|   A  |   A  |   B  |
|   B  |   C  |   A  |
|   C  |   C  |   B  |
|   A  |   E  |   C  |
|   D  |   B  |   E  |
|   B  |   E  |   D  |
+------+------+------+

我想进行排名,显示每个选项最多选择的选项。我已经有了这个,其中Rank是选项的排名,number是选项的计数:

+------+------+------+
| Rank | Opt1 | Numb |
+------+------+------+
|   1  |   A  |   2  |
|   1  |   B  |   2  |
|   3  |   C  |   1  |
|   3  |   D  |   1  |
+------+------+------+ (I have 3 of these, one for each option)

我现在想要做3个选项的摘要,进行相同的排名但加入选项。它会是这样的:

+------+------+------+
| Rank |Opt123| Numb |
+------+------+------+
|   1  |   B  |   5  |
|   2  |   A  |   4  |
|   2  |   C  |   4  |
|   4  |   E  |   3  |
|   5  |   D  |   2  |
+------+------+------+

最简单的方法是从3个排名表或原始的3个数据列中获取数据?我该怎么做?我已经有了公式来获取选项的名称,计数和排名,但我不知道如何使它们与多个coluns一起使用。

我拥有的(F列是数据列之一):

另一张纸上的B栏:

=SORT(UNIQUE(FILTER('Form Responses'!F2:F;NOT(ISBLANK('Form Responses'!F2:F)))); RANK(COUNTIF('Form Responses'!F2:F; UNIQUE(FILTER('Form Responses'!F2:F;NOT(ISBLANK('Form Responses'!F2:F))))); COUNTIF('Form Responses'!F2:F; UNIQUE(FILTER('Form Responses'!F2:F;NOT(ISBLANK('Form Responses'!F2:F))))); TRUE); FALSE)

C栏:

=ArrayFormula(COUNTIF('Form Responses'!F2:F; FILTER(B2:B;NOT(ISBLANK(B2:B)))))

A栏:

=ARRAYFORMULA(SORT(RANK(FILTER(C2:C;NOT(ISBLANK(C2:C))); FILTER(C2:C;NOT(ISBLANK(C2:C))))))

1 个答案:

答案 0 :(得分:3)

编辑:

合并cols:

=TRANSPOSE(split(join(",",D2:D,E2:E),","))

合并2个cols,不是很干净,但有效。 (与此处Stacking multiple columns on to one?相同)

完整公式:

=SORT(UNIQUE(FILTER(TRANSPOSE(split(join(",",D2:D,E2:E),","));NOT(ISBLANK(TRANSPOSE(split(join(",",D2:D,E2:E),",")))))); RANK(COUNTIF(TRANSPOSE(split(join(",",D2:D,E2:E),",")); UNIQUE(FILTER(TRANSPOSE(split(join(",",D2:D,E2:E),","));NOT(ISBLANK(TRANSPOSE(split(join(",",D2:D,E2:E),","))))))); COUNTIF(TRANSPOSE(split(join(",",D2:D,E2:E),",")); UNIQUE(FILTER(TRANSPOSE(split(join(",",D2:D,E2:E),","));NOT(ISBLANK(TRANSPOSE(split(join(",",D2:D,E2:E),","))))))); TRUE); FALSE)

转置可以在排序后完成。