Can I use OR within a MATCH function?

mjhokie13

New Member
Joined
Nov 29, 2016
Messages
2
I am trying to make a counter using a match function. The below formula is what I was using, and it works fine, but I am needing the MATCH to look for multiple arguments. I tried an OR function but it returns an error.

=IFERROR(MATCH("X",OFFSET('Unit Data'!$C$2,0,$A$8-1,COUNTA('Unit Data'!$C:$C),1),0),"")

I tried an OR function, as shown below, but it doesn't work. How do I fix this?

=IFERROR(MATCH(OR("X","Y","Z"),OFFSET('Unit Data'!$C$2,0,$A$8-1,COUNTA('Unit Data'!$C:$C),1),0),"")
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
welcome to the board

This fails because OR("X","Y","Z") will be evaluated by itself and return a #value! error. OR is a logical formula that returns TRUE or FALSE, it doesn't allow you to look for X or Y or Z. You'll probably have to look for each value individually, and then return the minimum value

Sadly this would make your formula
=MIN(IFERROR(MATCH("X",OFFSET('Unit Data'!$C$2,0,$A$8-1,COUNTA('Unit Data'!$C:$C),1),0),""),IFERROR(MATCH("Y",OFFSET('Unit Data'!$C$2,0,$A$8-1,COUNTA('Unit Data'!$C:$C),1),0),""),IFERROR(MATCH("Z",OFFSET('Unit Data'!$C$2,0,$A$8-1,COUNTA('Unit Data'!$C:$C),1),0),""))
 
Upvote 0
Ahh, that makes sense. Will MIN work if my lookup value in the MATCH function is a text item? I assumed MIN only worked with numeric values.


welcome to the board

This fails because OR("X","Y","Z") will be evaluated by itself and return a #value! error. OR is a logical formula that returns TRUE or FALSE, it doesn't allow you to look for X or Y or Z. You'll probably have to look for each value individually, and then return the minimum value

Sadly this would make your formula
=MIN(IFERROR(MATCH("X",OFFSET('Unit Data'!$C$2,0,$A$8-1,COUNTA('Unit Data'!$C:$C),1),0),""),IFERROR(MATCH("Y",OFFSET('Unit Data'!$C$2,0,$A$8-1,COUNTA('Unit Data'!$C:$C),1),0),""),IFERROR(MATCH("Z",OFFSET('Unit Data'!$C$2,0,$A$8-1,COUNTA('Unit Data'!$C:$C),1),0),""))
 
Upvote 0
I am trying to make a counter using a match function. The below formula is what I was using, and it works fine, but I am needing the MATCH to look for multiple arguments. I tried an OR function but it returns an error.

=IFERROR(MATCH("X",OFFSET('Unit Data'!$C$2,0,$A$8-1,COUNTA('Unit Data'!$C:$C),1),0),"")

I tried an OR function, as shown below, but it doesn't work. How do I fix this?

=IFERROR(MATCH(OR("X","Y","Z"),OFFSET('Unit Data'!$C$2,0,$A$8-1,COUNTA('Unit Data'!$C:$C),1),0),"")
What are you trying to achieve? -- To see if any/all of "X","Y","Z" are present in your range?
 
Upvote 0
Agree with Tetra, something doesn't add up here, so what are you actually trying to do?

MATCH will return the location within a range that contains the value you're looking for - so it will return 1 if found in the first cell, 2 if in the second etc. It won't return a text item. Therefore MIN works in this case - but if you're expecting a text answer then you're asking the wrong question
 
Upvote 0

Forum statistics

Threads
1,214,651
Messages
6,120,739
Members
448,989
Latest member
mariah3

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