Question

I'll start by describing my data

List1:
Company           Result
---------
Company1 (1234)   1
Company1 (1445)   1
Company3blabla    2
Company4          0

LookupList:
Company     Index
------------------
*Company1*    1
*Company3*    2

I'm trying to find a formula that will search for each Company in List1 if it contains a match from LookupList (hence the presence of * wild cards), and if so, it would return the corresponding index value, as shown in the Result column.

So far I got a formula that can return 1 if there's a match, and 0 if not, but I don't know how to get the index value from there:

{=MAX(ISNUMBER(SEARCH('LookupList'!$A$1:$A$2,List1[[#This Row],[Company]]))+0)}

Was it helpful?

Solution

You don't need the wildcards (SEARCH automatically searches within other text anyway) so you can remove those and use this formula in result column to get the INDEX value

=IFERROR(LOOKUP(2^15,SEARCH('LookupList'!$A$1:$A$2,List1[[#This Row],[Company]]),'LookupList'!$B$1:$B$2),"")

That will give you a blank if there is no match - change the "" at the end to text like "No match" if required

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top