Matching two columns based on partial text match

Pika735

New Member
Joined
Sep 14, 2020
Messages
15
Office Version
  1. 2019
Platform
  1. MacOS
  2. Web
I have a sheet with two columns of names and I need to see if one column has partial matches. For Example:

John Smith JOHN H SMITHFALSE (But should be TRUE)
Reba JonesSAMANTHA ROGERSFALSE
Taylor Johnson ANNA JOHNSONFALSE (But should be TRUE)

In this case, I need to know if surnames match or full names match but have an initial
I have tried If(Isnumber(Search but wasn't able to get it to work. Any ideas?
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
Also, there is an "Add-In" download that Microsoft has adopted for Excel in the link below. This will give you the percent match between 2 columns of names. I found this one particularly useful for situations like you are describing.

Fuzzy Lookup
 
Upvote 0
I need to know if surnames match or full names match but have an initial
Perhaps I am not grasping the requirement but surely the red check is not needed? After all, if the full names match with/without initial then the surnames must be matching so the blue test would be sufficient.

23 05 05.xlsm
ABC
1John SmithJOHN H SMITHTRUE
2Reba JonesSAMANTHA ROGERSFALSE
3Taylor JohnsonANNA JOHNSONTRUE
Match
Cell Formulas
RangeFormula
C1:C3C1=TRIM(RIGHT(SUBSTITUTE(A1," ",REPT(" ",50)),50))=TRIM(RIGHT(SUBSTITUTE(B1," ",REPT(" ",50)),50))
 
Upvote 0
Are these only for partial matches in the same row of column B or did you want to search the entire column B for any same row cell value in column A?
 
Upvote 0
Surely if all surname matches are "TRUE", then any full name with a middle initial will be "TRUE" per your example. If that is all you need and your range or data is A1:B3, then you could past the formula below in A3 and copy it down.

=IF(RIGHT(A1,FIND("/", SUBSTITUTE(A1," ","/", LEN(A1)-LEN(SUBSTITUTE(A1," ","")))))=RIGHT(B1,LEN(B1)-FIND("/", SUBSTITUTE(B1," ","/", LEN(B1)-LEN(SUBSTITUTE(B1," ",""))))),"TRUE","FALSE")
 
Upvote 0
An alternative is to load each table/range to Power Query Editor. Your example
Each column is its own table
Book1
ABCDE
1Column1Column1Column1Table2.Column1
2John SmithJOHN H SMITHJOHN SMITHJOHN H SMITH
3Reba JonesSAMANTHA ROGERSREBA JONES
4Taylor JohnsonANNA JOHNSONTAYLOR JOHNSONANNA JOHNSON
Sheet1

First Table
Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Uppercased Text" = Table.TransformColumns(Source,{{"Column1", Text.Upper, type text}})
in
    #"Uppercased Text"

Second Table
Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table2"]}[Content],
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Column1", type text}})
in
    #"Changed Type"

Join the two queries in a fuzzy match

Power Query:
let
    Source = Table.FuzzyNestedJoin(Table1, {"Column1"}, Table2, {"Column1"}, "Table2", JoinKind.LeftOuter, [IgnoreCase=true, IgnoreSpace=true, Threshold=.03]),
    #"Expanded Table2" = Table.ExpandTableColumn(Source, "Table2", {"Column1"}, {"Table2.Column1"})
in
    #"Expanded Table2"
 
Upvote 0
Surely if all surname matches are "TRUE", then any full name with a middle initial will be "TRUE" per your example. If that is all you need and your range or data is A1:B3, then you could past the formula below in A3 and copy it down.

=IF(RIGHT(A1,FIND("/", SUBSTITUTE(A1," ","/", LEN(A1)-LEN(SUBSTITUTE(A1," ","")))))=RIGHT(B1,LEN(B1)-FIND("/", SUBSTITUTE(B1," ","/", LEN(B1)-LEN(SUBSTITUTE(B1," ",""))))),"TRUE","FALSE")

Just wondering if that formula does something that the considerably simpler formula in post #4 doesn't do? :unsure:
 
Upvote 0
I did not see your formula when I went to post my response or I wouldn't have wasted the time on it. I just had something handy that I had done before that was very similar.
 
Upvote 0

Forum statistics

Threads
1,224,820
Messages
6,181,160
Members
453,021
Latest member
Justyna P

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