Delete comma at end of cell using Find & Replace

Jubinell

Board Regular
Joined
Jan 17, 2008
Messages
166
Hi,

I have a series of cells. Some of them end with the comma, and some do not. Some have really weird stuff in them (like manual line breaks).

Now I would like to go through each of the cells, and delete the ending comma when it occurs. Can I do this using the Find and Replace feature?

Note: there may be comma(s) in a cell but it/they is/are not always the last character of the cell.

Thank you in advance for your help!
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
Edit.

No don't use what i put. Didn't read that there were commas in the middle. Oops.
 
Last edited:
Upvote 0
try this
Code:
Sub test()
 
    Dim c As Range, lr As Long, lc As Long
 
    lr = Cells.SpecialCells(xlCellTypeLastCell).Row
    lc = Cells.SpecialCells(xlCellTypeLastCell).Column
 
    For Each c In Range(Cells(1, 1), Cells(lr, lc))
        If Right(c.Value, 1) = "," Then c.Value = Left(c.Value, Len(c.Value) - 1)
    Next c
 
End Sub
 
Upvote 0
Thanks...that does the job. I was hoping I could use some powerful features embedded in Excel's Find and Replace though.
 
Upvote 0
Nothing in the find and repace I'm afraid, but equally you could use a formula:

=LEFT(A1,LEN(A1)-(RIGHT(A1,1)=","))
 
Upvote 0

Forum statistics

Threads
1,215,499
Messages
6,125,163
Members
449,210
Latest member
grifaz

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