Need help with replacing text

imerictoo

New Member
Joined
Jun 26, 2018
Messages
3
Hello All,

Need help with replacing text as I have tried some formulas as well as a simple find & replace.
I have a string within a cell:
abc\Joe,abc\Mary,abc\harry,abc\,abc\,abc\

I want to remove the ,abc\,abc\,abc\

Any ideas?

Thanks,
Eric
 

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
Last edited:
Upvote 0
Maybe something like this:

Excel 2013/2016
AB
1abc\Joe,abc\Mary,abc\harry,abc\,abc\,abc\\Joe\Mary\harry\

<colgroup><col style="width: 25pxpx"><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Sheet1

Worksheet Formulas
CellFormula
B1=SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A1,"abc",""),",",""),"",""),"","")

<thead>
</thead><tbody>
</tbody>

<tbody>
</tbody>



The most inner iteration of the Substitute function is just in case you end up with 3 ""s together. If you'll have more than that, we may have to go a different route.

This is the actual formula I put in...it's not posting it right for some reason.

PHP:
=SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A1,"abc",""),",",""),"\\",""),"\\\","")
 
Last edited:
Upvote 0
This assumes you have no spaces in the data you want to keep as in your example:

Code:
=SUBSTITUTE(TRIM(SUBSTITUTE(SUBSTITUTE(A1,",abc",""),"\"," "))," ","\")

If there are spaces like Joe Smith for example, then try this:

Code:
=SUBSTITUTE(SUBSTITUTE(TRIM(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A1," ","~"),",abc",""),"\"," "))," ","\"),"~"," ")
 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,514
Messages
6,125,272
Members
449,219
Latest member
daynle

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