Use of wildcards inside MATCH

JesusPM

New Member
Joined
Sep 2, 2024
Messages
3
Office Version
  1. 365
  2. 2021
  3. 2019
Platform
  1. Windows
Hi experts,
I have a question regarding the use of INDEX,MATCH with a vector array and wildcards.
This example works fine, and it takes a partial string of 2-characters from A2 to return th ecorresponding device.
Excel Formula:
=INDEX({"Router","Meraki Router","Switch","Firewall","TermServer","Voice Gateway","TermServer"}, MATCH(MID(A2,6,2),{"rt","vp","sw","fw","ts","vg","-o"},0))

1725448664697.png


The problem that I have is that the nodes with the string "rt10[1-2]" are real routers, but the ones with string "rt1[1-2]" are switches (highlighted ones).
I've tried to deal with this by using this function, but it is not working with the wildcards:

=INDEX({"Router","Meraki Router","Switch","Switch","Firewall","TermServer","Voice Gateway","TermServer"}, MATCH(MID(A2,6,4),{"rt10","vp*","rt1*","sw*","fw*","ts*","vg*","-o*"},0))


I may be using the wildcards in the wrong way, or is this not supported?
 

Attachments

  • 1725448744959.png
    1725448744959.png
    5.5 KB · Views: 0

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
Wildcards only work for the lookup value, not the array you are looking up in, so you'd need to reverse the logic. See if this does what you want:

Excel Formula:
=LOOKUP(2,1/SEARCH({"vp","rt1","rt10","sw","fw","ts","vg","-o"},MID(A2,6,4)),{"Meraki Router","Switch","Router","Switch","Firewall","TermServer","Voice Gateway","TermServer"})
 
Upvote 0
Solution
Wildcards only work for the lookup value, not the array you are looking up in, so you'd need to reverse the logic. See if this does what you want:

Excel Formula:
=LOOKUP(2,1/SEARCH({"vp","rt1","rt10","sw","fw","ts","vg","-o"},MID(A2,6,4)),{"Meraki Router","Switch","Router","Switch","Firewall","TermServer","Voice Gateway","TermServer"})
You are legend, thanks for the tip and solution.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,173
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