Using Vlookup and Match with a wildcard

Peter Davison

Active Member
Joined
Jun 4, 2020
Messages
435
Office Version
  1. 365
Platform
  1. Windows
I have the following formula and in cell AD34 is the words "Own Brand Flag"

=IFERROR(VLOOKUP($A35,'[MasterData.xlsm]New Products'!$A$1:$Z$500,MATCH(AD$34,'[MasterData.xlsm]New Products'!$A$1:$T$1,0),FALSE),"")

Because in the New Products sheet the heading may be different e.g Private Brand Flag or Private Brand

I wanted to use a wild card to find it.
I've tried using an asterix before and after the cell reference but just get an error. (e.g. "*"AD$34&"*")

Can't work out what I am doing wrong.
Any help would be appreciated.

Thanks
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
I don't know if I am missing something here but "*Own Brand Flag*" is not going to find "Private Brand Flag" or "Private Brand".
Can you use "*Brand*" or "Private Brand*" ?

Also your first range is A to Z and the second A to T, this could be fine if you are only expecting the heading in A to T.
 
Upvote 0
My mistake it is A to Z on both, however the column is in column S so it would have been ok.
It is a tricky one on what to use in the search because I'm not sure what could be used.
Brand is used in its own column so I'll have to think about this one.

I can try and look up a mid part of the cell content and see where that takes me.
Thanks so much for your help.
 
Upvote 0
No problem. Hope you can find something that is consistent enough to match on.
PS: You have MS 365 you could try something along the lines of ="*Brand*" and <> "Brand"
 
Upvote 0
How would the
="*Brand*" and <> "Brand"
fit into the VLookup below?

=IFERROR(VLOOKUP($A35,'[MasterData.xlsm]New Products'!$A$1:$Z$500,MATCH(AD$34,'[MasterData.xlsm]New Products'!$A$1:$Z$1,0),FALSE),"")
 
Upvote 0
Can you rely on the Heading "Brand" always being to the left of the Heading with Private Brand or Private Brand Flag ?

If you can then this might work for you. It looks using the wild card and starts looking from the right to the left.
Excel Formula:
=IFERROR(
          VLOOKUP($A35,'[MasterData.xlsm]New Products'!$A$1:$Z$500,
                           COLUMN(XLOOKUP("*"&D34&"*",'[MasterData.xlsm]New Products'!$A$1:$AA$1,'[MasterData.xlsm]New Products'!$A$1:$AA$1,"",2,-1))),
     "")

There are most likely better ways of doing this. I think the question is different enough to the original question for you to open a new thread so that you get other people answering you, who have more experience with linking to other workbooks.
If you do open a new thread then make sure you clarify whether you need it to work when the workbook MasterData is closed. Not all formulas work when the linked workbook is closed.
 
Upvote 0
Solution
Thankyou for your help, I will give this a try and see where we go with it.
You have been most helpful.
Regards
 
Upvote 0

Forum statistics

Threads
1,214,956
Messages
6,122,465
Members
449,085
Latest member
ExcelError

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