2

I have a table which looks like this:

   A     B      C    D  
1 red   blue  green white  
2 blue  red   white yellow
3 red   blue  green white  
4 red   blue  green white 

and would like to get a result like this:

col1 col2 col3
1     A    red
1     B    blue
1     C    green
.
.
3     A    red
3     B    blue

It is kind of the opposite of the creation of a pivot table.

Is there any way on how do this with a function or plugin in Google Spreadsheet?

migrated from stackoverflow.com Nov 4 '13 at 1:26

This question came from our site for professional and enthusiast programmers.

1

Assuming the data is in four columns, seed F1 and G1 with 1 and A respectively, enter in H1:

=offset(indirect("A"&F1),,column()-8+mod(row()-1,4))  

in F2:

=if(mod(row()-1,4)=0,F1+1,F1)  

in G2:

=if(F1=F2,char(code(G1)+1),G$1)  

and copy all formulae down to suit.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.