Search code examples
regexgoogle-sheetsgoogle-sheets-formulavlookuptextjoin

Partial Vlookup not finding value on Google Sheets


I was trying on Google Sheets a very simple VLookup with partial match (using wild card), and for some reason I can't seem to make that work. My formula is rather simple:

=VLOOKUP("*"&A2&"*",$D:$E,2,0)

Where D:E is my lookup table and A2 is the cell to be partially searched. I'm searching for the word "John J" while in my lookup table I have "John" with Id 1. So my VLOOKUP above should return 1.

enter image description here

Here is the Google Spreadsheet with the issue. Any idea what could be the issue?


Solution

  • you need to do it like this:

    =INDEX(IFNA(VLOOKUP(REGEXEXTRACT(A2:A5, TEXTJOIN("|", 1, D2:D)), D:E, 2, 0)))
    

    enter image description here