How To Delete All Commas Found After First Comma On A Line

Spellbot5000

New Member
Joined
Apr 18, 2013
Messages
4
Hey everyone. I'll a complete newb when it comes to Excel, but nevertheless I'm still the most skilled person with a computer in my department so I've been tasked with a project.

I have a long list of item names in a single column, and the names are filled with commas. I'm trying to figure out how to strip out all commas except the very first one found on each line. So I have a list like:

Retr, Cheek, Bishop
Frcp, Tissue, 1x2, 5.5IN
Frcp, Tissue, Adson, 1x2
Handle, Scalpel, #3
Suction, Rosen, 1.5, ENT
Suction, Adson, 5.5IN, 12fr
Obturator, Suction, Adson, 5.5IN, 12fr

And I would need the finished list to look like:

Retr, Cheek Bishop
Frcp, Tissue 1x2 5.5IN
Frcp, Tissue Adson 1x2
Handle, Scalpel #3
Suction, Rosen 1.5 ENT
Suction, Adson 5.5IN 12fr
Obturator, Suction Adson 5.5IN 12fr

Can anyone provide some tips or perhaps a formula I can use to perform this action. Any info would be greatly appreciated, thanks!
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
Give this formula a try...

=SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A1,",","|",1),",",""),"|",",")
 
Upvote 0
Give this formula a try...

=SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A1,",","|",1),",",""),"|",",")
Or were you looking to physically change your actual data in place within their current cells? If so, you can do that with a macro...
Code:
Sub RemoveExtraCommas()
  Dim Addr As String
  Addr = "A1:A" & Cells(Rows.Count, "A").End(xlUp).Row
  Range(Addr) = Evaluate("IF(LEN(" & Addr & "),SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(" & _
                         Addr & ","","",""|"",1),"","",""""),""|"","",""),"""")")
End Sub
HOW TO INSTALL MACROs
------------------------------------
If you are new to macros, they are easy to install and use. To install it, simply press ALT+F11 to go into the VB editor and, once there, click Insert/Module on its menu bar, then copy/paste the above code into the code window that just opened up. That's it.... you are done. To use the macro, go back to the worksheet with your data on it and press ALT+F8, select the macro name (RemoveExtraCommas) from the list that appears and click the Run button. The macro will execute and perform the action(s) you asked for.
 
Upvote 0
The macro worked perfectly! I altered it a little for the column I was working in, and it did the job flawlessly. Thanks again!
 
Upvote 0

Forum statistics

Threads
1,214,573
Messages
6,120,310
Members
448,955
Latest member
Dreamz high

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