将值组合在一列中,展平分组值并创建新列

时间:2015-08-27 13:17:16

标签: excel csv

也许我在这里向Excel(Mac OSX)提出太多要求。 很抱歉,标题可能含糊不清,通过示例很容易解释: 我们有一个像

这样的表格
+----------+---------+---------+----------+
| username | course  |  group  |   role   |
+----------+---------+---------+----------+
| A        | music   | X       | student |
| A        | math    | Y       | student  |
| A        | spanish | Z       | student  |
| B        | music   | X       | student  |
| B        | math    | Y       | teacher  |
+----------+---------+---------+----------+

我想按用户名进行分组,但有点像“扁平化”。分组,创建一个如下所示的表:

+----------+---------+----------+---------+---------+--------+---------+---------+--------+---------+
| username | course1 |  group1  |  role1  | course2 | group2 |  role2  | course3 | group3 |  role3  |
+----------+---------+----------+---------+---------+--------+---------+---------+--------+---------+
| A        | music   | X        | student | math    | Y      | student | spanish | Z      | student |
| B        | music   | X        | student | math    | Y      | teacher |         |        |         |
+----------+---------+----------+---------+---------+--------+---------+---------+--------+---------+

无论我在Excel中做什么,都必须能够动态命名和创建这些列 - 即一些用户将拥有最多的课程3'其他人,直到' course12'

任何帮助都非常感谢:)

0 个答案:

没有答案