Columns to rows query

Adrian10

New Member
Joined
May 11, 2023
Messages
8
Office Version
  1. 365
Platform
  1. Windows
Good Morning
I have just joined the forum this morning in the hope that somebody could help me with a problem i am having with my excel spreadsheet.
I have a large file that consists of data that looks like this :

0001N500AX
0002N501AX
0002N247CS
0002N501AX
0003N502AX
0003(N247CS)
0004N504AX
0004(N500AX)
0004N504AX

What i need to do is convert the data so it looks like this :-

0001 N500AX
0002 N501AX N247CS N501AX
0003 N502AX (N247CS)
0004 N504AX (N500AX) N504AX

and so on, i realise i can select each serial number individually and use convert to row, but i have 500,000 rows !!

is there a VBA or macro Solution for this ? I attach a image to better illustrate what i am trying to achieve

Any help would be much appreciated

Regards

Adrian
 

Attachments

  • Screenshot 2023-05-11 112859.png
    Screenshot 2023-05-11 112859.png
    35.7 KB · Views: 14

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
as you have 365 version

use
=UNIQUE(A1:A9)
to pull out all the reference numbers
and then
=TEXTJOIN(" ",,FILTER($B$1:$B$9,$A$1:$A$9=D1))
and copy down for the strings

Book6
ABCDE
10001N500AX0001N500AX
20002N501AX0002N501AX N247CS N501AX
30002N247CS0003N502AX (N247CS)
40002N501AX0004N504AX (N500AX) N504AX
50003N502AX
60003(N247CS)
70004N504AX
80004(N500AX)
90004N504AX
Sheet1
Cell Formulas
RangeFormula
D1:D4D1=UNIQUE(A1:A9)
E1:E4E1=TEXTJOIN(" ",,FILTER($B$1:$B$9,$A$1:$A$9=D1))
Dynamic array formulas.
 
Upvote 0
Solution
Many many thanks for the swift reply, that works perfectly

Best Regards

Adrian
 
Upvote 0
Another option if you want the col B vales in their own cells is.
Fluff.xlsm
ABCDEFGHI
1
20001N500AX0001N500AX
30002N501AX0002N501AXN247CSN501AX
40002N247CS0003N502AX(N247CS)
50002N501AX0004N504AX(N500AX)N504AX
60003N502AX
70003(N247CS)
80004N504AX
90004(N500AX)
100004N504AX
11
Main
Cell Formulas
RangeFormula
E2:E5E2=UNIQUE(FILTER(A2:A100,A2:A100<>""))
F2,F5:H5,F4:G4,F3:H3F2=TOROW(FILTER($B$2:$B$100,$A$2:$A$100=E2))
Dynamic array formulas.
 
Upvote 0
Hi fluff,

I used etaf's method as described in their post, then I highlighted the results, then did text to columns delimited by space, this method is far quicker !!

Many Thanks
 
Upvote 0
Not sure how that's quicker than a formula that does it all, but as long as your happy, that's fine :)
 
Upvote 0
I used etaf's method as described in their post,
Thanks , I tried Fluff when he posted , as i do with most of Fluff replies, and other members , i learn so much stuff that way
It should be much easier , all done in 1 go
anyway -
you are welcome and glad to have helped and provided a solution
 
Upvote 0

Forum statistics

Threads
1,224,820
Messages
6,181,155
Members
453,021
Latest member
Justyna P

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