重新排列 Excel 中的数据
我不确定如何在没有说明的情况下提出这个问题,所以这里是: 我得到了一项测试的结果,该测试测试了人们对 16 个不同等级的不同声音的态度(分数 1-5)。数据集看起来像这样(其中 P1、P2、P3 是参与者,A、B、C 是声音)
Aformal Apleasant Acool Bformal etc
P1 2 3 1 4
P2 5 4 2 4
P3 1 2 4 3
但是,我想重新排列我的数据,如下所示:
formal pleasant cool
P1A 3 3 5
P1B 2 1 6
P1C etc
P1D
这意味着更多的行(每个参与者多行) ,并且列少得多。是否可以无需在新的 Excel 文件中手动重新输入所有分数?
I'm not sure how to ask this question without illustrating it, so here goes:
I have results from a test which has tested peoples attitudes (scores 1-5) to different voices on a 16 different scales. The data set looks like this (where P1,P2,P3 are participants, A, B, C are voices)
Aformal Apleasant Acool Bformal etc
P1 2 3 1 4
P2 5 4 2 4
P3 1 2 4 3
However, I want to rearrange my data to look like this:
formal pleasant cool
P1A 3 3 5
P1B 2 1 6
P1C etc
P1D
This would mean a lot more rows (multiple rows per participant), and a lot fewer columns. Is it doable without having to manually reenter all the scores in a new excel file?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当然,没问题。我刚刚破解了这个解决方案:
基本上,在 L 列和 M 列中,我制作了两列带有索引号的列。语音编号从 1 到 3,每 3 行重复一次,因为有 nv=3 个语音(如果有语音 F、G、H...,请增加此值)。人员编号也每行重复 3 行,因为有 nv=3 个语音。
为了制作行标题(P1A 等),我使用了以下公式:
="P" & L2& P1A 处的 CHAR(64+M2)
并向下复制。为了制作新的值表,我在 P1A-formal 中使用了以下公式:
=OFFSET(B$2,$L2-1,($M2-1)*3)
,并向下和横向复制。请注意,B$2
对应于原始值表(您的示例)中 P1-Aformal 的单元格地址。我已经使用了这个索引技巧不知道多少次来快速重新排列从其他人那里继承的数据表。
编辑:请注意,索引列也是使用公式(半)自动创建的。前 nv=3 行是手动创建的,然后后续行引用它们。例如,L5中的公式为
=L2+1
,M5中的公式为=M2
。两者都被复制到表的末尾。Sure, no problem. I just hacked this solution:
Basically, in columns L and M, I made two columns with index numbers. Voice numbers go from 1 to 3 and repeat every 3 rows because there are nv=3 voices (increase this if you have voices F, G, H...). Person numbers are also repeated for 3 rows each, because there are nv=3 voices.
To make the row headers (P1A, etc.), I used this formula:
="P" & L2 & CHAR(64+M2)
at P1A and copied down.To make the new table of values, I used this formula:
=OFFSET(B$2,$L2-1,($M2-1)*3)
at P1A-formal, and copied down and across. Note thatB$2
corresponds to the cell address for P1-Aformal in the original table of values (your example).I've used this indexing trick I don't know how many times to quickly rearrange tables of data inherited from other people.
EDIT: Note that the index columns are also made (semi)automatically using a formula. The first nv=3 rows are made manually, and then subsequent rows refer to them. For example, the formula in L5 is
=L2+1
and the formula in M5 is=M2
. Both are copied down to the end of the table.