Removing the final comma and any text after it

Jon_London

New Member
Joined
Jan 24, 2019
Messages
12
Office Version
  1. 365
Hi everyone

I have a requirement to remove the final comma and any text after it in a spreadsheet (example image below):

1647368532518.png


So, in the example I would like to remove ,SomethingOrOther on the second row then ,ThisAndThat on the third row and so on. The text after the final comma can vary quite a lot, so a simple replace wouldn't really work.

Does anyone know a way to do this please? We have a huge spreadsheet and have to manually remove this data each month.

Many thanks
Jon
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)

Maybe
Excel Formula:
=LEFT(A2,FIND("^",SUBSTITUTE(A2,",","^",LEN(A2)-LEN(SUBSTITUTE(A2,",",""))))-1)
 
Upvote 0
Solution
Hi,

Assuming data start at A2 down, in B2, copied down:

Excel Formula:
=TRIM(LEFT(SUBSTITUTE(A2,",",REPT(" ",LEN(A2)),6),LEN(A2)))
 
Upvote 0
Fantastic, thank you. Both of those work perfectly.

I've also updated my version of Excel in the Account section.
 
Upvote 0

Forum statistics

Threads
1,214,821
Messages
6,121,759
Members
449,048
Latest member
excelknuckles

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