VLOOKUP wildcard woes

basicallyawesome

New Member
Joined
Jul 10, 2018
Messages
29
Office Version
  1. 365
Hi, I am having the worst time with a basic VLOOKUP. Ive googled and I really feel like it should work but… it doesnt.
My main sheet has a list of birds, some specified “barn owl”, some not. My comparison sheet has broad groupings (e.g., owl)
My VLOOKUP in B2 on my main sheet looks like
Excel Formula:
=VLOOKUP("*"&A2,Sheet2!A1:D350,2,FALSE)
Everything I’ve read says the cells with barn owl should return results because ofthe Wildcard in the formula and owl in sheet 2. However, it is returning #N/A. All others that are exact match are returning results. This is a problem, because I’m trying to catch misses caused by our current VLOOKUP which just finds exact matches, which can and have resulted in a contract breach. Any ideas how I can fix this?
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
What version of Excel are you using?

I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)

Does this make any difference
Excel Formula:
=VLOOKUP("*"&A2&"*",Sheet2!A1:B350,2,FALSE)
 
Upvote 0
With your owl/barn owl example,
  1. What exactly is in cell A2 of your main sheet?
  2. What exactly is in column A of Sheet2 that you think should match if the wildcard was working?
Also be aware that if you are trying to match bird names using a short name like "owl" & using wildcards, you might accidentally match birds like
black-cowled oriole
owlet-nightjar
guineafowl
meadowlark
greater yellowlegs
lowland akalat
 
Upvote 0
Everything I’ve read says the cells with barn owl should return results because ofthe Wildcard in the formula and owl in sheet 2
If A2 contains "barn owl" your formula is looking for anything in sheet2 column A that ends with "barn owl"
 
Upvote 0
What version of Excel are you using?

I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)

Does this make any difference
Excel Formula:
=VLOOKUP("*"&A2&"*",Sheet2!A1:B350,2,FALSE)
Thank you for the suggestion, I’ve updated my account details.

I realized yesterday when I was at work having forgot to check in here for responses and unable at that point to reply to any, that the formula was doing what it was designed to do… which wasn’t what I wanted it to. I did find this solution in the forum, which despite dating back over a decade, almost does what I need (E.g., turns up results whether barn or owl), however, I realized I also need barn-owl which the above doesn’t catch, but at least I’m closer.
 
Upvote 0
If A2 contains "barn owl" your formula is looking for anything in sheet2 column A that ends with "barn owl"
You are correct, I realized that yesterday reproducing the spreadsheet on the site I found that solution on.

i did find this, which almost does what I want, but doesn’t turn up barn-owl (with the dash presumably being the problem).
 
Upvote 0
Yes, that kind of relates to Peter's question. Is a hyphen the only "special" character that might be involved?
 
Upvote 0
Whoops! Missed Peter’s question entirely.
.. and still not answered it. ;)

With your owl/barn owl example,
  1. What exactly is in cell A2 of your main sheet?
  2. What exactly is in column A of Sheet2 that you think should match if the wildcard was working?

Better still, could you give us a smallish set of sample data from both sheets, including examples with "-", (and include the expected results) with XL2BB so that we can do some testing with your data?
 
Upvote 0
Yes, hyphen is the only “special” character that might be involved
It would still be preferable to have a representative data sample, but perhaps a small amendment to the formula Aladin posted in the thread you linked to - something like:

Excel Formula:
=LOOKUP(9.99999999999999E+307,SEARCH(" "&$D$2:$D$10&" "," "&SUBSTITUTE(A2,"-"," ")&" "),$E$2:$E$10)
 
Upvote 0

Forum statistics

Threads
1,224,815
Messages
6,181,135
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top