# Can I use OR within a MATCH function?

#### mjhokie13

##### New Member
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

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
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

=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),""))

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

=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),""))

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?

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

Replies
1
Views
288
Replies
10
Views
488
Replies
5
Views
880
Replies
1
Views
392
Replies
6
Views
530

1,196,213
Messages
6,014,032
Members
441,801
Latest member
Aneurysm

### 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.

### Which adblocker are you using?

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

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