Excel formula to move different column data into rows

bastiaan_vg

New Member
Joined
Apr 17, 2007
Messages
15
Hi There,

We have an Excel list with data row and column wise like:
Column A . . . Column B . . . . . Column C
Code1. . . . . .Text1_C1 . . . . . . Adon1_C1
. . . . . . . . . . . . . . . . . . . . . . .Adon2_C1
Code2 . . . . . .Text1_C2 . . . . . .Adon1_C2
. . . . . . . . . . Text2_C2 . . . . . .Adon2_C2
. . . . . . . . . . Text3_C2

We want to transpose this into the following:
Column A . . . . . Column B
Code1 . . . . . . . . List:
. . . . . . . . . . . . Text1_C1
. . . . . . . . . . . . Documentation:
. . . . . . . . . . . . Adon1_C1
. . . . . . . . . . . . Adon2_C1
Code2 . . . . . . . . List:
. . . . . . . . . . . . Text1_C2
. . . . . . . . . . . . Text2_C2
. . . . . . . . . . . . Text3_C2
. . . . . . . . . . . . Documentation:
. . . . . . . . . . . . Adon1_C2
. . . . . . . . . . . . Adon2_C2

Is there a formula that can achieve this. If there is data in column B, then it must start with "List" in the new situation. Same as for column C, we want to start with "Documentation".

We have a big list and we do not know for column B and C how many entries there are, there could be none, 1, 2 or even more entries.

Thanks for any help, effort,
Bastiaan
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
As far as a formula, there might be a way... but, it would be way complex. VBA would be a viable solution.

Or, if you're interested, I can offer you a few steps to get the data in the way you mention. Just know, it would be a multiple step process. Let me know if you'd like the steps or if you'd rather hold out and see if someone posts some VBA for you.
 
Upvote 0
As far as a formula, there might be a way... but, it would be way complex. VBA would be a viable solution.

Or, if you're interested, I can offer you a few steps to get the data in the way you mention. Just know, it would be a multiple step process. Let me know if you'd like the steps or if you'd rather hold out and see if someone posts some VBA for you.

He there,
Thanks for your reply.
As I don't know VBA, the steps are fine for me.

Cheers,
Bastiaan
 
Upvote 0
1. In ColA, Select the entire range of rows that your data occupies. Hit "find & select" -"Go to special" in the ribbon, and select blanks.
2. With the blanks highlighted, hit "=" and the the up arrow, then hit ctrl+enter. (At this point, your data should say Code1, Code1, Code2,Code2,Code2...)
3. In D1, enter 1. in D2, enter "=if(a2=a1,d1+1,1)" <---drag this down all the rows, so you should end up with a counter for each code.
4. In E1, enter =a1&"|"&d1&"|A|"&b1 <--drop down, so it would read "Code1|A|1|Text1_C1
5. In E1, enter =a1&"|"&d1&"|B|"&c1 <--drop down, so it would read "Code1|B|1|Adon1_C1
6. Copy ColE and past special, values into a new range. Do the same for ColF, but paste it directly under the ColE range. (so you should have one long list)
7. Put a filter on that row and sort alphabetically.
8. From here you can use Text-to-columns on the data tab with pipe ( | ) as the deliminator.

This method will put everything in the order you requested, but it won't say "list:" or "Documentation:" before each section of Code. However, you can use find & replace (ctrl+f) to replace "a" with "list" and "b" with "documentation".

Also, you can do the same numbering trick with if() statements to add in List and Documentation if you really need. Hope this helps and you can follow!

Just remember, all you're doing if you follow these steps is creating a numbering system that will sort alphabetically.
 
Upvote 0
Thanks for the answer, I have tried it and it works :)
I only need to figure out how to add the "List" and "Documentation".
Maybe I will post another message for this.

Thanks for your help
 
Upvote 0

Forum statistics

Threads
1,213,538
Messages
6,114,218
Members
448,554
Latest member
Gleisner2

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