Remove Last Comma

pinkgemini

New Member
Joined
Jul 14, 2008
Messages
7
Hi There,
I'm doing data clean up for a client & have run across data that contains a comma at the end. They've supplied it to me this way & from what I can see it just ends (there is no space after the final comma) IE:

Cheerful, Chipper, Convivial, Delighted, Ecstatic, Elated, Exultant, Pleasant, Pleased, Sparkling, Sunny, Tranquil, Unadorned, Symphony,

The next row may be similar in descriptors but not contain the extraneous comma at the end. IE:

Compassionate, Tender, Calm, Countrified, Priestly, Tranquil, Unadorned, Symphony, Pastoral

Is there a way to remove the final comma in the fields where it's just "dangling" at the end but not remove it from the fields that don't contain the extraneous comma?

Obviously Find & Replace doesn't work because I need the commas to remain throughout the rest of the data. I've searched the boards & have not found a formula that works...if I've missed something that's already posted I apologize. I'm going a bit cross eyed at the moment & with thousands of rows to go through, I'd hate to have to remove the ending comma's one at a time!

Many thanks,
pinkgemini
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
Hello pinkgemini welcome to MrExcel. If data is in A1 try this formula

=LEFT(A1,LEN(A1)-(RIGHT(A1)=","))
 
Upvote 0
Barry Houdini, you saved my week (and my vision)!

Thank you so very much for your very quick & perfect reply...you're the best!

Many, many thanks,
pinkgemini

:)
 
Upvote 0
Sorry to be a pest...Barry Houdini's formula was perfect for most of the data I'm working on, but I've encountered a few times where there's a space after the extraneous comma so the Formula does not work in those fields.

I thought (wrongly) that I could just adjust the formula with a comma & a space (have tried adding it in the formula several ways(comma space in quotes) ", " and (space comma in quotes) " ," and (comma in quotes & a space in quotes)","" ". Obviously I'm no Excel guru so any advice would be greatly appreciated!

Best Regards,
pinkgemini

:oops:
 
Upvote 0
Thank you Rastaman, that worked perfectly!j

So glad to have found the Mr.Excel forum...you guys all rock!

Many thanks :)
 
Upvote 0
Rastaman(Jul 15th, 2008, 08:51 AM) answer helped me lot in the upload of ta.wiktionary. Thanks Indeed. Is it possible to replace instead of removal of the last character. I want to replace last semicolon with |(pipeline) instead of remove. This is for my 30,000 word list.
 
Upvote 0
Do you always want the pipeline character at the end of every string, or are there times when you don't want it? If you always want it, can you concatenate onto the existing formula?

=LEFT(A2,LEN(TRIM(A2))-(RIGHT(TRIM(A2))=","))&"|"

If you only want it when the string ends in a comma:

=LEFT(A4,LEN(TRIM(A4))-(RIGHT(TRIM(A4))=","))&IF(RIGHT(TRIM(A4))=",","|","")


Rick
 
Upvote 0

Forum statistics

Threads
1,214,919
Messages
6,122,260
Members
449,075
Latest member
staticfluids

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