# Excel Formula - If ...or ...and ...or ....and

#### Tracy in Calfifornia

##### New Member
I want to use multiple values within conditions to check for validity. Example: If a=3 and b=4 or if a=5 and b=8 or if a=15 and b= 27 then "pass' else "fail". How do I compose a formula for this?

### Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
With your two values a and b in cells D7 and E7, respectively:
=IF(OR(AND(D7=3,E7=4),AND(D7=5,E7=8),AND(D7=15,E7=27)),"pass","fail")

This will currently give "fail" if both are blank. Post back if that's not what you want. Hope that helps!

Welcome.

=if(or(and(a=3,b=4),and(a=5,b=8),and(a=15,b=27)),"Pass","Fail")

Replace a and b with the cell references.

e.g.:
=IF(OR(AND(A1=3,B1=4),AND(A1=5,B1=8),AND(A1=15,B1=27)),"Pass","Fail")

I think that will work for me...thanks!

Replies
2
Views
222
Replies
0
Views
100
Replies
1
Views
148
Replies
4
Views
146
Replies
2
Views
134

1,207,423
Messages
6,078,443
Members
446,338
Latest member
AliB

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