Data Vertical changed to Horizontal

Hi Experts

I need some help trying to figure out the best way to handle a task but I am having some difficulty.  I have 3 columns of data--A=EntityID, B=Question, C=Answer.  What I need to do is create one row of data that has the ID in column E, the questions (there are 5 different questions) as column headers F-J and the answers in each column matched by the entity ID.  

I've uploaded a sample sheet that has examples of the before as the after I need.  Anything you might do would be greatly appreciated.

A
DTI-DEMOGRAPHIC-SUBSCRIPTION.xlsx
spudmccAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ryan ChongBusiness Systems Analyst , ex-Senior Application EngineerCommented:
I joined the col A & B for a quick solution...

so you may hide the col D accordingly.

see sample attached for more info.

OR you may need to use a macro function or some advanced excel functions (tried some but didn't work for me at this moment...) to achieve that
DTI-DEMOGRAPHIC-SUBSCRIPTION-b.xlsx
Subodh Tiwari (Neeraj)Excel & VBA ExpertCommented:
You may try this......

To get the unique EntityId in col. E, try this Array Formula (which requires confirmation with Ctrl+Shift+Enter instead of Enter alone).

In E2
=IFERROR(INDEX($A$2:$A$100,MATCH(0,INDEX(IF($A$2:$A$100<>"",COUNTIF($E$1:E1,$A$2:$A$100)),0,0),0)),"")

and copy down until you get blank cells.

Now in F2, try this.....

=INDEX($C$2:$C$25,MATCH(1,INDEX(($A$2:$A$25=$E2)*($B$2:$B$25=F$1),0),0))

and copy across and down.

For detail, see the attached.
DTI-DEMOGRAPHIC-SUBSCRIPTION.xlsx
Saurabh Singh TeotiaCommented:
I'm assuming this is what you are looking for without adding extra columns to give you desired results..

Also this is not an array formula so in a larger data set will be fast to evaluate and give answers...

Saurabh...
DTI-DEMOGRAPHIC-SUBSCRIPTION.xlsx

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
PMI ACP® Project Management

Prepare for the PMI Agile Certified Practitioner (PMI-ACP)® exam, which formally recognizes your knowledge of agile principles and your skill with agile techniques.

Ryan ChongBusiness Systems Analyst , ex-Senior Application EngineerCommented:
Tks Saurabh, just curious to know more... : )

I saw you put the formula such as: =LOOKUP(2,1/(($A$2:$A$25=$F3)*($B$2:$B$25=G$1)),$C$2:$C$25)

I found that if we replace the first parameter from "2" to "1", it will still work.

=LOOKUP(1,1/(($A$2:$A$25=$F3)*($B$2:$B$25=G$1)),$C$2:$C$25)

Do you have any idea how does it works?
Saurabh Singh TeotiaCommented:
Ryan,

The (($A$2:$A$25=$F3)*($B$2:$B$25=G$1)), will generate a answer in true/FALSE's. which is a boolean.. so 1/(($A$2:$A$25=$F3)*($B$2:$B$25=G$1)) will either result an aswer of 1 or an error.. Now in this since the value of 2 it won't be able to find in 1/(($A$2:$A$25=$F3)*($B$2:$B$25=G$1))  ..Now it will start searching right to left..So as a result it returns the last value which matches all the criteria..and normally in this case since the last value is the only value it returns that as answer...

You can go to formula-->Evaluate formula to see further how it's getting evaluated..

Saurabh...
Ryan ChongBusiness Systems Analyst , ex-Senior Application EngineerCommented:
Well explained, Saurabh! : )
spudmccAuthor Commented:
Thank you so much for your solution.  This really is what I was looking for and very much appreciate your time and knowledge.  

Andy
Saurabh Singh TeotiaCommented:
Ryan... You are welcome...

Andy..Happy to Help.. :-)

Saurabh...
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.