Ignoring Middle name/ initial in match

Joined
Apr 16, 2021
Messages
44
Office Version
  1. 365
Platform
  1. Windows
  2. Web
Hi,

How can I make this formula ignore middle initials/ names that appear on either the Sheet I’m working on (Active Sheet) or on the sheet I’m pulling from (the Master Sheet)?

This is what I currently have in cell A2 (this version can't handle middle names/ initals):
=TRIM(IFERROR(INDEX(Master Sheet Column A,MATCH(RIGHT(B2,LEN(B2)-FIND(" ",B2))&", "&LEFT(B2,FIND(" ",B2)-1), Master Sheet Column B,0),1),"Fill in"))

Active Sheet:

Active Sheet.png


Master Sheet:

Master Sheet.png


Thanks in advance!!!
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
Two formulas that should work, you only need one or the other, but both should accomplish what you want.

=TRIM(LEFT(B2,FIND(" ",LOWER(B2),1))) & " " & TRIM(MID(B2,FIND(" ",LOWER(B2),FIND(" ",LOWER(B2),1)+1)+1,LEN(B2)-FIND(" ",LOWER(B2),1)+1))

OR

=LEFT(B2,FIND(" ",B2))&TRIM(RIGHT(SUBSTITUTE(B2," ",REPT(" ",99)),99))
 
Upvote 0
Here is a line of VBA code to strip the middle names/initials from a column:

VBA Code:
    Columns("B:B").Replace What:=" * ", Replacement:=" ", LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, ReplaceFormat:=False
 
Upvote 0
For the name formats that you have shown in those samples, see if this helps.

Areallusernamestaken.xlsm
AB
1IDName
21111Apples, Adam R
32222Barnes, Bert
43333Clements, Cathy Stacy
54444Delacruz, Dorothy
Master sheet


Areallusernamestaken.xlsm
AB
1IDName
21111Adam Apples
32222Bert P Barnes
43333Cathy Y Clements
54444Dorothy Delacruz
Sheet1
Cell Formulas
RangeFormula
A2:A5A2=XLOOKUP(TRIM(RIGHT(SUBSTITUTE(B2," ",REPT(" ",50)),50))&" "&LEFT(B2,FIND(" ",B2)-1),TRIM(LEFT(SUBSTITUTE(SUBSTITUTE('Master sheet'!B$2:B$10,",","")," ",REPT(" ",50)),100)),'Master sheet'!A$2:A$10,NA())


BTW, the answer to your username is "no" :LOL:
 
Upvote 0
Thank you johnnyL and thank you Peter_SSs! I appreciate your help!

Peter_SSs, yeah... I got a little frustrated when I was trying to register because any username I typed in was "taken." So I finally did this one and it worked!
 
Upvote 0

Forum statistics

Threads
1,215,653
Messages
6,126,046
Members
449,282
Latest member
Glatortue

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