|
Question : Lookup Values with Substring Match instead of Exact Match
|
|
I wanted to know how to convert a vlookup or similar lookup functionality to match values by a substring instead of an exact match.
What's there right now (this formula is from cell Z1 on Sheet2: =VLOOKUP(G1,Sheet1!$A$1:$B$65365,2,FALSE)
What I really need it to do: Check and see if G1 is a subset/substring of any of the values in Sheet1!$A$1:$B$65365, then return the value in column 2 of Sheet1 (that corresponds to the match in column 1 or A). Sheet 1 basically has labels in column 1/A and values in column 2/B and the function should search on labels but return values.
|
|
Answer : Lookup Values with Substring Match instead of Exact Match
|
|
Hi endrec,
This ugly array formula does it; if the substring is not found, it returns a #REF error:
{=INDEX(Sheet1!$B$1:$B$65535,MIN(IF(NOT(ISERROR(SEARCH(G1,Sheet1!$A$1:$A$65535))),ROW(Sheet1!$A$1:$A$65535),100000)),1)}
Regards,
Patrick
|
|
|
|