Formatting Survey Results in Excel

%3CLINGO-SUB%20id%3D%22lingo-sub-1573972%22%20slang%3D%22en-US%22%3EFormatting%20Survey%20Results%20in%20Excel%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1573972%22%20slang%3D%22en-US%22%3E%3CP%3EHello!%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI'm%20trying%20to%20find%20a%20way%20to%20reformat%20results%20of%20a%20survey%20that%20are%20currently%20being%20exported%20to%20a%20spreadsheet%20in%20multiple%20rows%20per%20respondent%20(1%20row%20per%20question)%20so%20that%20we%20can%20provide%20a%20version%20with%20only%20one%20row%20per%20respondent%20(1%20column%20per%20question).%20In%20it's%20simplest%20form%2C%20the%20problem%20is%20changing%20this%20table%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CTABLE%20border%3D%221%22%20width%3D%22100%25%22%3E%3CTBODY%3E%3CTR%3E%3CTD%20width%3D%2233.333333333333336%25%22%20height%3D%2230px%22%3EID%3C%2FTD%3E%3CTD%20width%3D%2233.333333333333336%25%22%20height%3D%2230px%22%3EQuestion%3C%2FTD%3E%3CTD%20width%3D%2233.333333333333336%25%22%20height%3D%2230px%22%3EResponse%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%20width%3D%2233.333333333333336%25%22%20height%3D%2230px%22%3E1%3C%2FTD%3E%3CTD%20width%3D%2233.333333333333336%25%22%20height%3D%2230px%22%3E1%3C%2FTD%3E%3CTD%20width%3D%2233.333333333333336%25%22%20height%3D%2230px%22%3Eyes%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%20width%3D%2233.333333333333336%25%22%20height%3D%2230px%22%3E1%3C%2FTD%3E%3CTD%20width%3D%2233.333333333333336%25%22%20height%3D%2230px%22%3E2%3C%2FTD%3E%3CTD%20width%3D%2233.333333333333336%25%22%20height%3D%2230px%22%3Eno%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%20height%3D%2230px%22%3E2%3C%2FTD%3E%3CTD%20height%3D%2230px%22%3E1%3C%2FTD%3E%3CTD%20height%3D%2230px%22%3Eyes%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%20height%3D%2230px%22%3E2%3C%2FTD%3E%3CTD%20height%3D%2230px%22%3E2%3C%2FTD%3E%3CTD%20height%3D%2230px%22%3Eyes%3C%2FTD%3E%3C%2FTR%3E%3C%2FTBODY%3E%3C%2FTABLE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Einto%20this%20one%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CTABLE%20border%3D%221%22%20width%3D%22100%25%22%3E%3CTBODY%3E%3CTR%3E%3CTD%20width%3D%2233.333333333333336%25%22%20height%3D%2230px%22%3EID%3C%2FTD%3E%3CTD%20width%3D%2233.333333333333336%25%22%20height%3D%2230px%22%3EQuestion%201%3C%2FTD%3E%3CTD%20width%3D%2233.333333333333336%25%22%20height%3D%2230px%22%3EQuestion%202%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%20width%3D%2233.333333333333336%25%22%20height%3D%2230px%22%3E1%3C%2FTD%3E%3CTD%20width%3D%2233.333333333333336%25%22%20height%3D%2230px%22%3Eyes%3C%2FTD%3E%3CTD%20width%3D%2233.333333333333336%25%22%20height%3D%2230px%22%3Eno%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%20width%3D%2233.333333333333336%25%22%20height%3D%2230px%22%3E2%3C%2FTD%3E%3CTD%20width%3D%2233.333333333333336%25%22%20height%3D%2230px%22%3Eyes%3C%2FTD%3E%3CTD%20width%3D%2233.333333333333336%25%22%20height%3D%2230px%22%3Eyes%3C%2FTD%3E%3C%2FTR%3E%3C%2FTBODY%3E%3C%2FTABLE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThis%20would%20need%20to%20be%20extendable%20so%20as%20to%20support%20an%20arbitrary%20number%20of%20IDs%20and%20questions%2C%20but%20the%20ID's%20are%20all%20unique%2C%20and%20the%20questions%20are%20always%20labeled%20the%20same%20way%2C%20and%20the%20response%20is%20always%20in%20the%20same%20column.%20Building%20the%20columns%20manually%20is%20not%20an%20issue%2C%20assuming%20I%20can%20just%20copy%20the%20same%20basic%20method%20and%20replace%20the%20question%20value.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAny%20ideas%3F%20Thanks!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1573972%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EFormulas%20and%20Functions%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1574387%22%20slang%3D%22en-US%22%3ERe%3A%20Formatting%20Survey%20Results%20in%20Excel%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1574387%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F753074%22%20target%3D%22_blank%22%3E%40NickMoore%3C%2FA%3E%26nbsp%3BThe%20most%20flexible%20solution%20would%20be%20to%20use%20Get%26amp%3BTransform%20Date%20(a.k.a.%20PowerQuery)%2C%20provided%20you%20are%20on%20a%20Windows%20version%20of%20Excel.%20Though%2C%20if%20you%20have%20never%20used%20it%20before%2C%20it%20may%20be%20a%20bit%20overwhelming.%20In%20the%20attached%20example%2C%20I%20take%20your%20data%20table%20and%20pivot%20the%20%22Question%22%20column%20with%20%22Response%22%20as%20the%20'non-aggregated'%20value.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAnother%20solution%20would%20be%20to%20use%20the%20new%20FILTER%20and%20UNIQUE%20functions%2C%20provided%20your%20version%20of%20Excel%20supports%20it.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EA%20third%20option%20would%20be%20to%20use%20'good%20old'%20INDEX%20and%20MATCH.%20I%20inserted%20a%20helper%20column%20to%20the%20data%20table%2C%20combining%20the%20RespondentID%20and%20the%20Question%20number%2C%20in%20order%20to%20keep%20it%20fairly%20simple.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20latter%20two%2C%20however%2C%20are%20less%20dynamic%20and%20need%20some%20coping%2Fpasting%20to%20display%20the%20results.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
Occasional Visitor

Hello!

 

I'm trying to find a way to reformat results of a survey that are currently being exported to a spreadsheet in multiple rows per respondent (1 row per question) so that we can provide a version with only one row per respondent (1 column per question). In it's simplest form, the problem is changing this table:

 

IDQuestionResponse
11yes
12no
21yes
22yes

 

into this one:

 

IDQuestion 1Question 2
1yesno
2yesyes

 

This would need to be extendable so as to support an arbitrary number of IDs and questions, but the ID's are all unique, and the questions are always labeled the same way, and the response is always in the same column. Building the columns manually is not an issue, assuming I can just copy the same basic method and replace the question value.

 

Any ideas? Thanks!

1 Reply
Highlighted

@NickMoore The most flexible solution would be to use Get&Transform Date (a.k.a. PowerQuery), provided you are on a Windows version of Excel. Though, if you have never used it before, it may be a bit overwhelming. In the attached example, I take your data table and pivot the "Question" column with "Response" as the 'non-aggregated' value.

 

Another solution would be to use the new FILTER and UNIQUE functions, provided your version of Excel supports it.

 

A third option would be to use 'good old' INDEX and MATCH. I inserted a helper column to the data table, combining the RespondentID and the Question number, in order to keep it fairly simple.

 

The latter two, however, are less dynamic and need some coping/pasting to display the results.