Excel XLOOKUP and Wildcard

Soldato
Joined
20 Feb 2004
Posts
22,701
Location
Hondon de las Nieves, Spain
I'm opening this by saying i'm baffled.

My dad has asked me to do some lookups for him, effectively Looking for instances of values in Column A in either column G or column H. Column H is easy because it'd be a 1:1 match. Column G i needed to use a Vlookup with the wildcard to search for the value within the string.

UBNv4pU.png


Everything came back perfectly well. However he then clarified he needed the Stock No (column F) being returned. The easy way here would be to just move the column to the right of the lookup columns and then continue with the VLOOKUP. However, i figured it'd be more efficient to use the XLOOKUP and look to the left. I've used the exact same logic. Using the XLOOKUP without the wildcard works. Using it with the Wildcard gives an error. I've tried googling and there doesn't seem to be any reason for the error. Potentially because it's a number, but i've tried converting it to text and multiplying by 1 to convert to a number to see if anything works.

Example of XLOOKUP working without the wildcard
cLgZVfv.png


Example of XLOOKUP not working with the wildcard
LLTOS6f.png
 
You need to use the wildcard match mode option. When not set it will use exact match by default.

=XLOOKUP("*"&A2&"*",I:I,G:G,FALSE,2)

The FALSE is shown if there is no match - you can change it to "" or any value.

2 is used in the match mode section for wildcards. 0 is exact -1 is exact or next smaller, 1 is exact or next larger.
 
Back
Top Bottom