Combine information from many columns into one but skip if blank and insert commas

rette

New Member
Joined
Oct 29, 2015
Messages
6
Have 6 columns of data (like below but some columns could be blank or even all) and then a column that will summarize the preceding information such as the examples below:

[TABLE="class: outer_border, width: 609"]
<colgroup><col width="87" span="7" style="width:65pt"> </colgroup><tbody>[TR]
<!--StartFragment--> [TD="width: 87"]AG1[/TD]
[TD="width: 87"]MSC1[/TD]
[TD="width: 87"]MG1[/TD]
[TD="width: 87"]SR1[/TD]
[TD="width: 87"]AA1[/TD]
[TD="width: 87"]CY1[/TD]
[TD="width: 87"]PG1[/TD]
<!--EndFragment--> [/TR]
</tbody>[/TABLE]

next column would show the following:
AG1, MSC1, MG1, SR1, AA1, CY1, PG1

OR like the below if cells are blank,

[TABLE="class: outer_border, width: 609"]
<colgroup><col width="87" span="7" style="width: 65pt;"></colgroup><tbody>[TR]
[TD="width: 87"]AG1[/TD]
[TD="width: 87"][/TD]
[TD="width: 87"]MG1[/TD]
[TD="width: 87"]SR1[/TD]
[TD="width: 87"][/TD]
[TD="width: 87"][/TD]
[TD="width: 87"]PG1[/TD]
[/TR]
</tbody>[/TABLE]

next column would show the following:
AG1, MG1, SR1, PG1
[TABLE="width: 609"]
<tbody>[TR]
[TD="width: 87"][/TD]
<!--EndFragment--> [/TR]
</tbody>[/TABLE]
I need a formula that will summarize, skip blanks and add the commas. Please help - had it figured out but computer crashed in the middle but my export was a csv and I stupidly hadn't converted to an XLS yet and so it flattened the formula and I couldn't restore and now I can't re-create.

Thanks!
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
Try this assuming there will not be any pre existing spaces in any of the original values.

=SUBSTITUTE(TRIM(A1&" "&B1&" "&C1&" "&D1&" "&E1&" "&F1&" "&G1)," ",", ")
 
Upvote 0
The most efficient approach would be to write a UDF but if you want a formula solution, try: =SUBSTITUTE(TRIM(A1&" "&B1&" "&C1&" "&D1&" "&E1&" "&F1&" "&G1)," ",",")
 
Upvote 0
YAY You guys are life savers!!!! Report is due this afternoon and had found the formula on this board and tweaked it to work but couldn't get back there. This is what a couple concussions will do to your memory.

Life long user!
 
Upvote 0

Forum statistics

Threads
1,223,098
Messages
6,170,106
Members
452,302
Latest member
TaMere

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