Consolidate text cells into one cell - seperated by comma

nikegeo

Board Regular
Joined
Jul 23, 2010
Messages
52
Hey Everyone,

as the topic says im trying to consolidate a # of cells (text values) into 1 cell seperated by a ",_" (underscore = space)

i have over 53 cells that i'd like to go from

<table border="0" cellpadding="0" cellspacing="0" width="244"><col style="mso-width-source:userset;mso-width-alt:8923;width:183pt" width="244"> <tbody><tr style="height:15.0pt" height="20"> <td class="xl65" style="height:15.0pt;width:183pt" height="20" width="244">Argentina</td> </tr> <tr style="height:15.0pt" height="20"> <td class="xl65" style="height:15.0pt;border-top:none" height="20">Canada</td> </tr> <tr style="height:15.0pt" height="20"> <td class="xl65" style="height:15.0pt;border-top:none" height="20">Colombia</td> </tr> <tr style="height:15.0pt" height="20"> <td class="xl65" style="height:15.0pt;border-top:none" height="20">Costa Rica</td> </tr> <tr style="height:15.0pt" height="20"> <td class="xl65" style="height:15.0pt;border-top:none" height="20">Dominican Republic</td> </tr> </tbody></table>
to

Argentina, Canada, Colombia, Costa Rica, Dominican Republic - All in one cell

I know i can concatenate it - =CONCATENATE(A9,", ",A10,", ",A11,", ",A12,", ",A13,", ", - but would love to avoid having to click 50+ cells and paste the ", ", each time

Anyway to make this easy?

thanks in advance
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
Try this UDF in a standard module

Code:
Function aconcat(r As Range) As String
aconcat = Join(Application.Transpose(r), ",_")
End Function

To use for example

=aconcat(A1:A50)
 
Upvote 0
Thanks for the quick response!

I'm not sure if im doing this correctly (Novice @ VB) - I created a new module in my personal.xlsb (macro workbook) and pasted code - saved - but the function is not recognized in my other workbook?
 
Upvote 0
fantastic it worked!

Anyway to make this a global function and have it in other spreadsheets?

Thanks again and you and this forum make my job so much more easier!
 
Upvote 0
As you have it in your personal.xlsb then it should be available in any workbook.
 
Upvote 0

Forum statistics

Threads
1,224,587
Messages
6,179,738
Members
452,940
Latest member
Lawrenceiow

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