Need help adjusting this formula for erratic data

TWTHOMAS

Board Regular
Joined
Mar 26, 2010
Messages
96
I have a database of personnel and as you can imagine there are thousands of variations of names.

I use this formula on Sheet 2 to extract the name data into a cleaner version so I can split the names into 5 columns of individual data.

=SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(Sheet 1_!C2,", "," ")," JR","JR"),"II"," II"),"III"," III")," SR","SR")

So for example I have these names in Column A of Sheet 1.

Jones, Karen J
Thomas, Joe E JR
Ecker, Sue
Farris, Tom II
Lamen, Bob J SR
Jameson, Eric SR

There are sometimes one and sometimes 2 spaces after each suffix. The first last and MI always have 1 space and a comma if there is a middle name.

So the formula above works great unless I have a name that contain 3 spaces or 1 space where the formula only has 2.

So what I need help with is adjusting this formula for the happenstance that there is a suffix that has 1, 2, or 3 space preceding it. I'm guessing I need to add more

(SUBSTITUTE

followed by more variations of

," SR","SR")

for example but wanted to make sure there isn't some kind of catch-all wildcard that will do the same thing.

Thanks
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
.
.

Have a look at Excel's TRIM function. It removes all spaces from text except for single spaces between words. Perhaps you can integrate it into your formula and simplify...

TRIM function - Excel
 
Upvote 0

Forum statistics

Threads
1,214,976
Messages
6,122,543
Members
449,089
Latest member
davidcom

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