AND & OR Together?

honkin

Active Member
Joined
Mar 20, 2012
Messages
385
Office Version
  1. 2016
Platform
  1. MacOS
hi

I am trying to get a particular result, but I have obviously got the syntax slightly wrong in my formula and I wonder if someone might look at it and indicate where I went wrong.

Here is the formula:-

Code:
=IF(AND(Q2="L",P2<=2.2,OR(Q2="P",P2<=2.2)),95,IF(AND(Q2="W",P2<=2.2),-100*P2+100,0))

In a nutshell I want to see if cell Q2 has either "P" or "L" in it and P2 <=2.20 then the result is 95. If Q2 has "W" in it and P2 is <=2.20, then this calculation is performed -100*P2+100

I get the correct result if "L" or "W" are in Q2, but if it is a "P", the result is always showing up as 0, even if P2 is <=2.20.

Any idea what needs correcting to make the formula achieve the desired result?

Thanks in advance
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
Try this

=IF(AND(OR(Q2={"L","P"}),P2<=2.2),95,IF(AND(Q2="W",P2<=2.2),-100*P2+100,0))

Or this


=IF(P2<=2.2,IF(OR(Q2={"L","P"}),95,IF(Q2="W",-100*P2+100,0)),0)
 
Last edited:
Upvote 0
Try this

=IF(AND(OR(Q2={"L","P"}),P2<=2.2),95,IF(AND(Q2="W",P2<=2.2),-100*P2+100,0))

Or this


=IF(P2<=2.2,IF(OR(Q2={"L","P"}),95,IF(Q2="W",-100*P2+100,0)),0)

Thanks so much DanteAmor. They both seem to give the right result, so I can opt for either.

Thanks again
 
Upvote 0
I'm glad to help you. Thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,224,820
Messages
6,181,157
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