removing multiple single characters from cells

tkjacob

New Member
Joined
Sep 30, 2004
Messages
20
I have been searching removing middle initials on the forums and have found multiple helpful, useful and functioning results except for when in this combination. I am trying to remove middle initials when there are 2 names in a cell. For example:

John J & Mary M Johnson
Marc L & Jenny K Jackson

I would like to easily convert these to just read:
John & Mary Johnson
Marc & Jenny Jackson

When I use the two most useful options the find/replace ' * ' AND the formula
=LEFT(A1,FIND(" ",A1))&TRIM(RIGHT(SUBSTITUTE(A1," ",REPT(" ",99)),99))
the results turn into:
John Johnson
Marc Jackson

Anyone have a different solution? I tried changing the & to 'and' which still generated the same results.
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Perhaps:

=LEFT(A1,FIND(" ",A1,1))&" & "&RIGHT(A1,LEN(A1)-SEARCH("& ",A1,1)-1)
 
Upvote 0
Sorry missed something:

=LEFT(A1,FIND(" ",A1,1))&" & "&TRIM(LEFT(RIGHT(A1,LEN(A1)-SEARCH("& ",A1,1)-1),SEARCH(" ",RIGHT(A1,LEN(A1)-SEARCH("& ",A1,1)-1)))&RIGHT(RIGHT(A1,LEN(A1)-SEARCH("& ",A1,1)-1),LEN(RIGHT(A1,LEN(A1)-SEARCH("& ",A1,1)-1))-SEARCH(" ",RIGHT(A1,LEN(A1)-SEARCH("& ",A1,1)-1))-1))
 
Upvote 0
Hi,

Perhaps:

=TRIM(REPLACE(REPLACE(SUBSTITUTE(A1," ",REPT(" ",999)),999,999,""),3*999,999,""))


Regards
 
Upvote 0
Here is a general formula that will work for single names (like Cher), normal names (like John Jackson), normal names with a middle initial/name (John Philip Sousa), and two first names coupled by an ampersand with or without middle initials/names (like John & Mary Jackson, John Jones & Mary Jackson, John & Mary Sue Jackson and John Jones & Mary Sue Jackson)...

=LEFT(A1,FIND(" ",A1&" "))&IF(COUNTIF(A1,"*&*"),"& "&TRIM(MID(SUBSTITUTE(TRIM(RIGHT(SUBSTITUTE(A1,"& ",REPT(" ",99)),99))," ",REPT(" ",999)),1,999))&" ","")&IF(COUNTIF(A1,"* *"),TRIM(RIGHT(SUBSTITUTE(A1," ",REPT(" ",99)),99)),"")
 
Upvote 0
Brilliant perfection! Thank you!

here is a general formula that will work for single names (like cher), normal names (like john jackson), normal names with a middle initial/name (john philip sousa), and two first names coupled by an ampersand with or without middle initials/names (like john & mary jackson, john jones & mary jackson, john & mary sue jackson and john jones & mary sue jackson)...

=left(a1,find(" ",a1&" "))&if(countif(a1,"*&*"),"& "&trim(mid(substitute(trim(right(substitute(a1,"& ",rept(" ",99)),99))," ",rept(" ",999)),1,999))&" ","")&if(countif(a1,"* *"),trim(right(substitute(a1," ",rept(" ",99)),99)),"")
 
Upvote 0
This formula also seems to work with names mentioned in #1 and #5 except Cher:

=TRIM(LEFT(A1,FIND(" ",A1))&IFERROR("&"&MID(SUBSTITUTE(A1," ",REPT(" ",99)),FIND("&",SUBSTITUTE(A1," ",REPT(" ",99)))+1,198),"")&RIGHT(SUBSTITUTE(A1," ",REPT(" ",99)),99))
 
Upvote 0

Forum statistics

Threads
1,217,482
Messages
6,136,905
Members
450,030
Latest member
Adalinda

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