使用Google Spreadsheets从行到列交叉制表

时间:2017-08-23 01:51:53

标签: google-sheets

我有一个表格,每个受访者都有问题和答案,我想在列中列出所有问题。有些人没有回答所有问题。

EG。转变这个:

+---------+----------------+---------+
| User_ID | Question_Title | Answer  |
+---------+----------------+---------+
|       1 | Question One   | Answer1 |
|       1 | Question Two   | Answer2 |
|       1 | Question Three | Answer3 |
|       2 | Question One   | Answer4 |
|       2 | Question Two   | Answer5 |
|       3 | Question One   | Answer6 |
+---------+----------------+---------+

进入那个:

+---------+--------------+--------------+----------------+
| User_Id | Question One | Question Two | Question Three |
+---------+--------------+--------------+----------------+
|       1 | Answer1      | Answer2      | Answer3        |
|       2 | Answer4      | Answer5      | --             |
|       3 | Answer6      | --           | --             |
+---------+--------------+--------------+----------------+

我尝试过数据透视表,但它们似乎不适用于文本值。任何线索?

1 个答案:

答案 0 :(得分:2)

     =QUERY(A1:C7,"select A,max(C) group by A pivot B ")

其中A是用户ID,C是答案列,B是问题列。 获取数据后,如有必要,请使用过滤器/数据透视表/其他QUERY进行排列。