Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
306 views
in Technique[技术] by (71.8m points)

excel - Transpose matrix into 2 columns

Hi I have an excel table which is formatted like this:

 NR   | 1 |2    |3   |4   |5
 Name |tom|alice|jack|brad|ed

 NR   | 6 |7   |8  |9    |10
 Name |ted|ally|jon|bronn|cony

 NR   | 11  |12  |13    |14    |15
 Name |trish|anna|thomas|justin|dick

 NR ....
 Name ...

I have 2000 rows like this. Obviously this table structure is really bad and unusable for any data analysis or data extraction. So I am trying to format it like this:

 Nr | Name
 _________
 1  | tom
 2  | alice
 3  | jack
 4  | brad
 5  | ed
 6  | ted
 7  | ally
 8  | jon
 9  | bronn
 10 | cony
 11 | trish
 12 | anna
 13 | thomas
 14 | justin
 15 | dick
 ...| ...

I have been manually transposing and inserting each two rows but that is taking way too long. Can I do this more efficiently or automatically? I am not really that good with advanced excel or VBA. Can I do this using only formulas?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Assuming your data start in A1, put this into F1:F10000:

=INDEX($A$1:$E$4000,2*(INT((ROW()-1)/5)+1),MOD(ROW()-1,5)+1)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...