View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Mark Mark is offline
external usenet poster
 
Posts: 989
Default vlookup retunrning a match, when not a match...

It appears VLOOKUP is counting the * as a wildcard search.

Right, it is.

I did just find in the help where it says it's going to do that. It
explains that in the Remarks section, and says you can use a tilde ~ in front
of the * to sell it not to do that.

But, I can't change my original data before doing the lookup.

Working with another person here, we've come up with a formula to tell it to
do an exact match on both * and ?

=SUBSTITUTE(SUBSTITUTE(C1,"*","~*"),"?","~?")

where the value to be looked up is in C1.

This whole thing goes into a piece of VBA code, so the " is going to need to
be "" .

That should be 'pretty'.

But I can do it.

Thanks.