Removing Middle Initial or Middle Name

Mschweider

New Member
Joined
Mar 2, 2015
Messages
12
I have a document where the name format is Last, First Middle Name/Initial. (Sometimes there is a period at the end of the middle initial, sometimes there is not, see below).

I was wondering if it was possible to remove the Middle name/initial using macros. I have found some help but there always seems to be something wrong in at least one case. The list of names is 1533 so I would like it to work without any input from me.

Some example name formats:
Smith, John
Smith, John L
Smith, John L.
Smith Dean, John (Smith Dean is two last names)
Smith Dean, John L
Smith Dean, John L.

I would like it to work with all of those difference since that is how the file comes to me, if possible.

This is the current formula I have found but it doesn't work with two last names:

=IF(LEN(A3)-LEN(SUBSTITUTE(A3," ",""))=1,A3,SUBSTITUTE(LEFT(A3,FIND("^^",SUBSTITUTE(A3," ","^^",2))-1),",","",2))

Thanks for any help!
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
Thanks! Works perfectly for what I needed. I found 1 Jr. in the list though. Is there anyone to modify it so it removes that?
 
Upvote 0
You're welcome.

Can you post a sample of the one with Jr, and what result you'd expect from it?
 
Upvote 0
The format for the Jr. changes slightly from above, which is strange. If its not possible, it's only one case.

Example:
Smith, Jr, John L
 
Upvote 0
Try

=LEFT(SUBSTITUTE(A1,"Jr, ",""),FIND(" ",SUBSTITUTE(A1,"Jr, ","")&" ",FIND(",",SUBSTITUTE(A1,"Jr, ",""))+2)-1)
 
Upvote 0
Here is a slightly shorter formula that also seems to work...

=TRIM(SUBSTITUTE(LEFT(A1,LEN(A1)-2*ISNUMBER(FIND(" ",RIGHT(A1,3)))),"Jr, ",""))
 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,410
Messages
6,124,752
Members
449,186
Latest member
HBryant

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