XLOOKUP or VLOOKUP to find specific word in array cell with multiple words in it, and how?

xdriver

Board Regular
Joined
Mar 21, 2014
Messages
73
Office Version
  1. 365
Platform
  1. MacOS
I have a list that contains the lookup values such as "Jo" and an array that has values in single cells such as "John Doe" and a different row such as "Jo Doe" what method and settings could I use to find the cells containing "Jo Doe" and not "John Doe"? Do i need to split the array name cells to make this work, since my current XLOOKUP will return both the "Jo Doe" and the "John Doe"
 
I haven't gone through all of them yet, but this looks amazing and I appreciate this help. Would it be possible to explain how you created this/what each part of the equation is doing? Thank you so much.
 
Upvote 0

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
Would it be possible to explain how you created this/what each part of the equation is doing?
=LET(n,FILTER(A$2:A$1016,A$2:A$1016<>""),IF(COUNT(SEARCH(" "&n&" ",SUBSTITUTE(" "&J2&" "&K2&" ","-"," "))),"Name List",""))

Remove all the empty cell values from col A and store them in a variable called "n"
Put a space character before & after each name stored in n. This is how we stop "Jo" from being found in "John".
Join the col J & K names with a space between and also add a space before/after each joined pair. Also replace "-" with a space character since you wanted "Smith" to be found in "Char-Smith" - I think? (If that is not the case we can remove that SUBSTITUTE part and shorten the formula)
Now search for each of the col A values (with space before/after) in the red part. For each of those approx. 1000 searches, if found it will return a number, if not it will return an error. COUNT will return how many numbers - that is, how many successful searches. If that number is anything other than 0 then it has found at least one name so returns "Name List" otherwise returns ""


Hope that makes some sense.
 
Upvote 0
Solution
=LET(n,FILTER(A$2:A$1016,A$2:A$1016<>""),IF(COUNT(SEARCH(" "&n&" ",SUBSTITUTE(" "&J2&" "&K2&" ","-"," "))),"Name List",""))

Remove all the empty cell values from col A and store them in a variable called "n"
Put a space character before & after each name stored in n. This is how we stop "Jo" from being found in "John".
Join the col J & K names with a space between and also add a space before/after each joined pair. Also replace "-" with a space character since you wanted "Smith" to be found in "Char-Smith" - I think? (If that is not the case we can remove that SUBSTITUTE part and shorten the formula)
Now search for each of the col A values (with space before/after) in the red part. For each of those approx. 1000 searches, if found it will return a number, if not it will return an error. COUNT will return how many numbers - that is, how many successful searches. If that number is anything other than 0 then it has found at least one name so returns "Name List" otherwise returns ""


Hope that makes some sense.
Makes perfect sense. Thank you for helping with the equation and the explanation.
 
Upvote 0

Forum statistics

Threads
1,215,073
Messages
6,122,970
Members
449,095
Latest member
Mr Hughes

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