Transposing and compressing data

NArawna

New Member
Joined
Dec 5, 2018
Messages
10
Hi, I am exporting from a database as a csv which provides the following ID,NAME,RATING

ID1BEN1
ID2BEN1
ID3BEN2
ID4BEN3
ID5JAMES1
ID1SAM1
ID4SAM2
ID2DAN1
ID9DAN2
ID10DAN2

<tbody>
</tbody>

I need to transform this into the following

ID1ID2ID3ID4ID5ID6ID7ID8ID9ID10
BEN1123
JAMES1
SAM12
DAN122

<tbody>
</tbody>

As you can see it has changed the ID from the horizontal to the vertical,
Filled in the missing ID numbers, in this case 6,7,and 8
it has changed the NAME from individual instances to a single unique instance for each
it has assigned the RATING under the ID for each NAME

My only progress towards the change so far is using paste-special with transpose to change the values from a horizontal to vertical layout.
Onward I am unsure and assume it would be quite VBA heavy?
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
Are you able to manually enter the ID numbers across as a header row in row 1 or are there too many?
Are you able to manually add the names as a header column in column A or are there too many?

If you're able to do both then a formula solution is possible otherwise it would probably have to be VBA which I'm not an expert.
 
Last edited:
Upvote 0
Hi,
You can do what you want to do wit a pivot table. I just did it using your source data. You Just need to give your columns headings like ID, Name an rating and he pivot table will do the rest
 
Upvote 0
Are you able to manually enter the ID numbers across as a header row in row 1 or are there too many?
Are you able to manually add the names as a header column in column A or are there too many?

If you're able to do both then a formula solution is possible otherwise it would probably have to be VBA which I'm not an expert.

Manual entry is not really an option as there are over 100 ID's.
 
Upvote 0
Hi,
You can do what you want to do wit a pivot table. I just did it using your source data. You Just need to give your columns headings like ID, Name an rating and he pivot table will do the rest

Hi, could you let me know the pivot settings you used?
Thanks.
 
Upvote 0
Hi
Copy your data to B1:C11.
Put column headings A1:C1, ID, Name, Rating.
Create pivot table
Rows = Names
Columns = ID
Values = ratings

If you don't know how to do it PM me your email and I'll send you the file I made.

Brian
 
Upvote 0
Hi
Copy your data to B1:C11.
Put column headings A1:C1, ID, Name, Rating.
Create pivot table
Rows = Names
Columns = ID
Values = ratings

If you don't know how to do it PM me your email and I'll send you the file I made.

Brian

Got it, thank you.
 
Upvote 0

Forum statistics

Threads
1,214,606
Messages
6,120,483
Members
448,967
Latest member
visheshkotha

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