I need to do a lookup and return the value based on if the text contains it.
Please see my excel sheet below, What I need is a formula, which will help my 'Category' column to be filled 'Category' column of the look up table.
Note: Kindly see my excel sheet in below link.
I tried the formula '=VLOOKUP(B2,A13:B16,2,TRUE)
' but it is not giving the expected result.
This is a slight twist on the normal "find this string inside a list of others". It requires an array formula that searches for matches using
FIND
.Picture of ranges
Formula in cell
A2
is an array formula (entered with CTRL + SHIFT + ENTER) and is copied down for each item. It searches in the list oflookup
for an item that is included initem
and returns the result fromcategory
associated withlookup
.How it works
INDEX
is returning fromcategory
and needs a row number to returnFIND
which will check if a string is included in part of another string. In this case, the string to search for is thelookup
table and we are matching within theitem
.FIND
will return#VALUE!
if no match is found, this is converted toFALSE
withIFERROR
because#VALUE!
will no work withMIN
later.IF
will then return theROW
number orFALSE
for the match that was found.MIN
is used to convert the list ofROW
numbers to the smallest number. This means that multiple matches are not handled.ROW
number is then used as the return for theINDEX
. There is an offset applied here-ROW(E1)
which allows for the data tables to start in a row other1:1
.