views:

436

answers:

2

I have a lookup table in Excel with ColA and ColB :

ColA    ColB   ColC
va       1     value1

ColC is the actual value table

I need to do a wildcard lookup with lookup_value = "value1" I need to perform an operation that if the value of ColC matches the characters in ColA then it should return me ColB value, i.e. 1

I want to use wildcards in the lookup function to achieve this result. Any help will be appreciated! Thanks

+1  A: 

You can use wildcards with VLOOKUP. You'll have to rearrange your table so that the lookup column is the first column, but other than that it should work. I put:

abc 1
def 2
ghi 3
jkl 4

into a range named "table"

Then:

g*
g?i
?kl

into F2:F4

Now, in G2:G4, I put this formula:

=VLOOKUP(F2,table,2,FALSE)

and it correctly found 3 in cells G2 & G3, and 4 in cell G4.

The asterisk means zero or more characters; the question mark means exactly one character.

Carl Manaster
A: 

You can do it this way:

=VLOOKUP(LOOKUP("value1",ColC:ColC,ColC:ColC), lookuprange, COLUMN(ColA) + 1, TRUE)

Of course you can simplify this with your domain knowledge.

This method allows you to use your lookup table as is.

Lance Roberts