Need help reformatting data, what formula should I use?

mejatom

New Member
Joined
Mar 25, 2023
Messages
5
Office Version
  1. 365
Platform
  1. Windows
Hello, this is my first time posting on this forum so please forgive me for any issues in this post.

I have survey data collected from a form. Because of the platform we are using, the responses are displayed similarly to the table on the left. Each participant's response spans multiple rows. I am trying to reformat the data into a sheet that looks like the table on the right, with each participant in one row, and the questions in a fixed order.
Capture2.PNG


My issue is figuring out what formula should go in column F, G, H, and I. As you can see in the left table, the order of the questions (Birthday, address etc.) is shuffled for each participant. Hence I'm not sure how to use something like OFFSET and INDEX to do this. Because there are multiple rows of each participant, I'm also not sure how to use VLOOKUP for this.

Would appreciate any help!
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
Hi,
For cell F2
Excel Formula:
=OFFSET($A$2,((ROW()-2)*4)+COLUMN()-6,2)
 
Upvote 0
Hi,
For cell F2
Excel Formula:
=OFFSET($A$2,((ROW()-2)*4)+COLUMN()-6,2)
Hi, thank you for your response!!
Yes, this code indeed works for cell F2, but I'm trying to come up with a generalisable formula for the entirety of column F. (In the actual data set I have 63 participants, all of which have their questions in a random order) So this formula must work for John as well.
 
Upvote 0
Quite obviously, you have not tested it ... ;)

The formula is built to be copied down and to the right ...

By the way, regarding Column E, starting in cell E2, you can have
Excel Formula:
=OFFSET($A$2,((ROW()-2)*4),0)
 
Upvote 0
Quite obviously, you have not tested it ... ;)

The formula is built to be copied down and to the right ...

By the way, regarding Column E, starting in cell E2, you can have
Excel Formula:
=OFFSET($A$2,((ROW()-2)*4),0)
Capture12.PNG

Oh, I have tested it! Am I doing something wrong? Because the Birthday and Address rows on the left are in random order, I don't think I can use the offset function.
 
Upvote 0
View attachment 88384
Oh, I have tested it! Am I doing something wrong? Because the Birthday and Address rows on the left are in random order, I don't think I can use the offset function.
Apologies, I didn't change the date format here, but yes the formula pulls the address for John (Since it's the first question John answers) instead of Birthday as it should be.
 
Upvote 0
Well you can add some coherence to your database in Columns A to C with a Sort by Name and then by Question ... ;)
 
Upvote 1
Solution
If your worksheet is really big the OFFSET function may cause it to slow down.
The following does not use volatile functions:

mr excel questions 17.xlsm
ABCDEFGHI
1NameQuestionAnswerBirthdayAddressPhone NumberFax Number
2MaryBirthday2000-08-03Mary2000-08-03ABC Road235584
3MaryAddressABC RoadJohn2000-03-05XYZ Road456314
4MaryPhone Number235
5MaryFax Number584
6JohnBirthday2000-03-05
7JohnAddressXYZ Road
8JohnPhone Number456
9JohnFax Number314
10
Sheet6
Cell Formulas
RangeFormula
E2:E3E2=INDEX($A$2:$A$9,((ROW(E2)-2)/0.25+1),MOD((COLUMN(E2)-5),3)+1)
F2:I3F2=INDEX($C$2:$C$9,MATCH($E2&F$1,$A$2:$A$9&$B$2:$B$9,0),1)
 
Upvote 1
Thank you both so much!

@James006, I'm not sure why I didn't think of that earlier! :LOL: I've done that and got it working, haha. Thank you!

@awoohaw, I will test this out in the future if needed, thank you very much!
 
Upvote 0
Glad to hear you have managed to solve your problem
 
Upvote 0

Forum statistics

Threads
1,215,425
Messages
6,124,826
Members
449,190
Latest member
rscraig11

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top