• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

transpose data from rows to columns grouped

Katya

New Member
Hi there! I have exported some data out of a database, and would like to pivot it so that some column entries become column headings. This is impossible to explaine properly, so I have a file attached with what I have and what I would like to achieve. Any help would be much much appreciated!
 

Attachments

  • pivot.xlsx
    9.5 KB · Views: 7
Good day Katya

Why not turn your raw data in to a table and then turn it into a pivot table?
 

Attachments

  • pivot.xlsx
    19.9 KB · Views: 5
Pivot table returns count of values, whereas I need the actual value (the text of the answer, not how many as it is always 1), unless I am missing something?
 
Hello Katya,
Welcome to the forum!

To get text values displayed, you can use formulas to get the desired results.

To get the Pivot Table effect, we need to break up the problem into three pieces:
Display the Row Headers (in your example the Names)
Display the Column Headers (in your example the Questions)
Finally, Display the Values (in your example the Answers)

To Display the Row Headers, the following array formula can be used. Put in cell G2 and copy down:
=IFERROR(INDEX(Names,MATCH(TRUE,ISNA(MATCH(Names,$G$1:$G1,0)),0)),"---")
enter with Ctrl + Shift + Enter

To Display the Column Headers, the following array formula can be used. Put in cell H1 and copy right:
=IFERROR(INDEX(Questions,MATCH(TRUE,ISNA(MATCH(Questions,$G$1:G$1,0)),0)),"---")
enter with Ctrl + Shift + Enter

To display the values, the following array formula can be used. Put in cell H2 and copy down and to the right:
=IFERROR(INDEX(Answers,MATCH(1,(Names=$G2)*(Questions=H$1),0)),"---")
enter with Ctrl + Shift + Enter

Chandoo-Katya-Pivot of Text.JPG

Attached is your workbook modified to include the above formulas.

Cheers,
Sajan.
 

Attachments

  • Chandoo-Katya-pivot of Text values.xlsx
    13 KB · Views: 8
Thank you Sajan, that works perfectly and is scalable as well. Appreciate the spreadsheet as well!
I have to say, I had a feeling that this can be achieved by MATCH and INDEX functions, but I find them really difficult to grasp!
 
Hello Katya,
Thanks for the feedback. Glad your problem is solved.

Regarding MATCH and INDEX functions, there are many resources available on this site (and elsewhere) that explain them. However, if you have any specific questions, please do not hesitate to ask!

Cheers,
Sajan.
 
Back
Top