Join all different groups separated by vertical bar

motilulla

Well-known Member
Joined
Feb 13, 2008
Messages
2,362
Office Version
  1. 2010
Hello,

I have 1 to 10 groups in columns C:L and he column N there is count of the groups

I need to join numbers are in row within columns C:L minimum 1 maximum 5 in the column P separated by vertical bar as shown in the example below

For a more detail the image is attached. Pease suggest formula or VBA

*ABCDEFGHIJKLMNOPQ
1
2
3
4GroupGroupGroupGroupGroupGroupGroupGroupGroupGroupTotal GroupJoin All Groups
512345678910Total GroupJoin All Groups
64678954 | 6 | 7 | 8 | 9
72381042 | 3 | 8 | 10
8347843 | 4 | 7 | 8
9127841 | 2 | 7 | 8
1078937 | 8 | 9
11121031 | 2 | 10
127827 | 8
133623 | 6
1445781054 | 5 | 7 | 8 | 10
1546834 | 6 | 8
1648934 | 8 | 9
1745934 | 5 | 9
1856735 | 6 | 7
19381033 | 8 | 10
2045834 | 5 | 8
21371033 | 7 | 10
2246934 | 6 | 9
23781037 | 8 | 10
2424632 | 4 | 6
2578937 | 8 | 9
26681036 | 8 | 10
27151031 | 5 | 10
284781044 | 7 | 8 | 10
29348943 | 4 | 8 | 9
30181031 | 8 | 10
31571035 | 7 | 10
3256935 | 6 | 9
33471034 | 7 | 10
3414691051 | 4 | 6 | 9 | 10
3514561051 | 4 | 5 | 6 | 10
3612361051 | 2 | 3 | 6 | 10
3735781053 | 5 | 7 | 8 | 10
3835791053 | 5 | 7 | 9 | 10
3913831 | 3 | 8
401267951 | 2 | 6 | 7 | 9
412457852 | 4 | 5 | 7 | 8
4223451052 | 3 | 4 | 5 | 10
4323681052 | 3 | | 8 | 10
44156941 | 5 | 6 | 9
452481042 | 4 | 8 | 10
46123541 | 2 | 3 | 5
471491041 | 4 | 9 | 10
4813491051 | 3 | 4 | 9 | 10
495671045 | 6 | 7 | 10
50124541 | 2 | 4 | 5
51257842 | 5 | 7 | 8
524591044 | 5 | 9 | 10
532356752 | 3 | 5 | 6 | 7
54281032 | 8 | 10
55111
56212
57
58

Thank you all.

I am using Excel 2000

Regards,
Moti
 

Attachments

  • Join All Groups.png
    Join All Groups.png
    71 KB · Views: 7

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
Hi Moti,

Get Excel updated and you can use the below in column P...
Excel Formula:
=TEXTJOIN(" | ",1,C6:L6)

But for 2000(!) use this in column P...

Excel Formula:
=SUBSTITUTE(TRIM(CONCATENATE(IF(C6="","",C6 & " "),IF(D6="","",D6 & " "),IF(E6="","",E6 & " "),IF(F6="","",F6 & " "),IF(G6="","",G6 & " "),IF(H6="","",H6 & " "),IF(I6="","",I6 & " "),IF(J6="","",J6 & " "),IF(K6="","",K6 & " "),IF(L6="","",L6 & " ")))," "," | ")

Steven
 
Upvote 0
Solution
After 2016, TEXTJOIN would do it for you:
Code:
=TEXTJOIN(" | ",TRUE,D7:M7)][code]
You can probably find a UDF if you search for it. I don't happen to have one.
 
Upvote 0
Hi Moti,

Get Excel updated and you can use the below in column P...
Excel Formula:
=TEXTJOIN(" | ",1,C6:L6)

But for 2000(!) use this in column P...

Excel Formula:
=SUBSTITUTE(TRIM(CONCATENATE(IF(C6="","",C6 & " "),IF(D6="","",D6 & " "),IF(E6="","",E6 & " "),IF(F6="","",F6 & " "),IF(G6="","",G6 & " "),IF(H6="","",H6 & " "),IF(I6="","",I6 & " "),IF(J6="","",J6 & " "),IF(K6="","",K6 & " "),IF(L6="","",L6 & " ")))," "," | ")

Steven
sxhall, yes your formula worked magical (y)

Thank you so much for your kind help

Kind regards,
Moti :)
 
Upvote 0
After 2016, TEXTJOIN would do it for you:
Code:
=TEXTJOIN(" | ",TRUE,D7:M7)][code]
You can probably find a UDF if you search for it. I don't happen to have one.
kweaver, yor are right TEXTJOIN is not computable with my version but it is solved by sxhall formula. Thank you for your attention

Kind regards,
Moti
 
Upvote 0
@motilulla whilst I know that you always state what version of Excel you are running, I would also suggest updating your account to show you version as there is now an option for "2003 or older"
 
Upvote 0
@motilulla whilst I know that you always state what version of Excel you are running, I would also suggest updating your account to show you version as there is now an option for "2003 or older"
Fluff, account update is done. As it gives me update Office Version 2003 or older I have checked this box.

And in the section about you: I have put the note; but in fact I am using Excel Version XL2000.

Thank you for the information

Kind Regards,
Moti :)
 
Upvote 0

Forum statistics

Threads
1,214,938
Messages
6,122,346
Members
449,080
Latest member
Armadillos

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