Data clean up w/ SUBSTITUTE

msvec

Board Regular
Joined
Feb 18, 2002
Messages
202
I'm trying to remove multiple strings from a column of data, and was hoping to do this with one function in an adjacent column. I've exhausted trying arrays and circumventing nesting...any clue how to do this without using VB.

Thanks much
 
On 2002-02-19 14:39, IML wrote:
I tried this and couldn't get it to work. To prevent user error such as mine with capitilzation, you could tweak this everso slightly with
=TRIM(SUBSTITUTE(A1,RIGHT(A1,SUMPRODUCT((LEN(A1)-LEN(SUBSTITUTE(UPPER(A1),{"JR.",", POD",", PHD."},""))))),""))

very nice, Aladin.

I devised this formula (of which an extended description how it works is available in the Archives) to remove the initial or closing nums from a string: aky1234 --> aky or the inverse operation: aky1234 --> 1234. The case to which I'm now applying it is a bit special. UPPER'ing is only needed, it seems, if you also have cases like Denise Dukakof, PHD. I advised expanding the constant array itself with such cases:

{"Jr.",", POD",", PhD.","JR.",", POD",", PHD"}

Both tactics should work, but maybe the latter is safer (untested).

Aladin
 
Upvote 0

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
sorry for resisting...works quite well. quite smart of you. needs a bit of tweeking to fit exactly what i need, but for working blindly, pretty impressive.

Thanks
 
Upvote 0

Forum statistics

Threads
1,213,490
Messages
6,113,957
Members
448,535
Latest member
alrossman

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