Concatenate With Delimiter

golfnut324

Board Regular
Joined
Jul 12, 2006
Messages
93
Can someone help me to concatenate across columns, say J through Q, (some of which are blank) and have the results delimited by a comma without returning anything for columns that might be blank. So R660 would read "0263B001A,FX9,FX-9,FX10,FX-10" and R669 would read "08A0477,GPR18,GPR-18". I need to apply this to a about 14000 rows in a worksheet.

Please help me with the details of vba and storing in a personal workbook.

Many thanks to all of your help time and time again.

Craig
Toner Data Base Load 01312009 0623.xls
JKLMNOPQR
6590263B001AFX9FX-9FX10FX-10
6600263B001AFX9FX-9FX10FX-10
6610264B001A
6620264B001A
6630264B001A
6640264B001A
6650264B001A
6660264B001A
6670264B001A
6680264B001A
6690384B003AAGPR18GPR-18
6700384B003AAGPR18GPR-18
67108A0477
Sheet1
 
here's another custom vba function that might suit your needs. hold alt+f11 and paste the below code into a new vba module (Insert\Module). use like a regular excel function eg = myCate(J659:Q659):


Code:
Private Function myCate(Target As Range)
 
Dim c As Range
Dim Temp As String
 
For Each c In Target
 
If c = "" Then
     'do nothing
  Else
     Temp = Temp & c.Value & ","
End If
 
Next
 
myCate = Mid(Temp, 1, Len(Temp) - 1)
 
End Function




Thank you all very much for the great help! I downloaded/installed moreunc,xll and now have all kinds of great tools. For the record, MCONCAT left a comma at the end of the string and on very long strings it removed the comma and one more character.

I installed code from crimson_blade1 (MYCATE) and it worked flawlessly. I'm going to keep working on STRINGCONCAT because I know I must be doing something wrong.

Thanks to you all again!

Craig
 
Upvote 0

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