Formula that can compare cells and return results for partial matches

Monty85

Board Regular
Joined
May 6, 2019
Messages
62
Office Version
  1. 365
Platform
  1. Windows
Can anyone point in the right direction for a formula that can compare two cells and return a result for a partial match?

For example, I need to compare a list of names where one column may or may not contain a middle name. I.e;

A1 = John Smith
B1 = John F. Smith

I need a way to reference A1 and return a "True" result if the content of A1 is found somewhere in B1.

Appreciate any and all ideas.
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
If you are not using 365:
Excel Formula:
=COUNT(SEARCH(TRANSPOSE(FILTERXML("<t><s>"&SUBSTITUTE(A1," ","</s><s>")&"</s></t>","//s")),B1))=COUNTA(TRANSPOSE(FILTERXML("<t><s>"&SUBSTITUTE(A1," ","</s><s>")&"</s></t>","//s")))


This is an array formula. You must press Ctrl+Shift+Enter together after paste.
 
Upvote 0
If you are not using 365:
Excel Formula:
=COUNT(SEARCH(TRANSPOSE(FILTERXML("<t><s>"&SUBSTITUTE(A1," ","</s><s>")&"</s></t>","//s")),B1))=COUNTA(TRANSPOSE(FILTERXML("<t><s>"&SUBSTITUTE(A1," ","</s><s>")&"</s></t>","//s")))


This is an array formula. You must press Ctrl+Shift+Enter together after paste.
Cool will give it a go - is there another option if im using Office 365
 
Upvote 0
Cool will give it a go - is there another option if im using Office 365
Yeah here is a way shorter hand with 365. I can not test it but this may work also. Maybe even shorter is possible but I am not experienced in 365:
Excel Formula:
=LET(s,TEXTSPLIT(A1," "),COUNT(SEARCH(s,B1))=COUNTA(s))
 
Upvote 0
If it is just comparing names and ignoring middle names then maybe:
Excel Formula:
=LET(s,TEXTSPLIT(B1," "),TAKE(s,,1) & " " & DROP(s,,COLUMNS(s)-1) = A1)

This method will however return false for the below example:
John Smith | John Smithd
 
Upvote 1
If it is just comparing names and ignoring middle names then maybe:
Excel Formula:
=LET(s,TEXTSPLIT(B1," "),TAKE(s,,1) & " " & DROP(s,,COLUMNS(s)-1) = A1)

This method will however return false for the below example:
John Smith | John Smithd
Oh yes, my suggestion will also return John F. as TRUE likewise John Smithd. Maybe you should go with Georgiboy's suggestion.
 
Upvote 0
Book1
ABC
1John SmithJohn F. SmithTRUE
2John SmithJohn SmithTRUE
3John SmithJohn SmithsFALSE
Sheet1
Cell Formulas
RangeFormula
C1:C3C1=OR(A1=B1,COUNTIF(B1,SUBSTITUTE(A1," "," * ")))
 
Upvote 1
Solution
If it is just comparing names and ignoring middle names then maybe:
Excel Formula:
=LET(s,TEXTSPLIT(B1," "),TAKE(s,,1) & " " & DROP(s,,COLUMNS(s)-1) = A1)

This method will however return false for the below example:
John Smith | John Smithd
This is awesome, thats actually more useful as I'd prefer that situation to return False so it could be checked manually.

Is this a Office 365 only formula? Or would that work in either version?
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,327
Members
452,635
Latest member
laura12345

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