# Thread: OR inside of AND IF (2003)

1. ## OR inside of AND IF (2003)

I'd like to learn how to use OR inside of AND IF. My current formula is :
IF(AND(AC20>=50000, AF20<=0.1), "Underbudget", "")

I'd like to also evaluate AC20 and if it is <=0 and AF20<=.1 also display "Underbudget". I think I need an OR for this. Any idea on how to do this?

2. ## Re: OR inside of AND IF (2003)

IF(AND(OR(AC20>=50000,AC20<=0), AF20<=0.1), "Underbudget", "")

3. ## Re: OR inside of AND IF (2003)

Harken back to your basic arithmetic lessons where there are rules of precedence:
1. <LI>First evaluate everything within brackets; then
<LI>Exponentiation; then
<LI>Multiplication and Division; then
<LI>In the case of operations of the same level of precedence, evaluation proceeds from left to right
In the case of Logic
1. <LI>First evaluate everything within brackets; then
<LI>items immediately separated by "AND"; then
<LI>items immediately separated by "OR"
I think that the above protocol will satisfy all situations. If not, other Loungers should quickly advise us of my error.

4. ## Re: OR inside of AND IF (2003)

For VBA Logicals, the order is:

Not
And
Or
Eqv
Imp

With the spreadsheet's pre-script notation, (AND(x,y)) the order of the precedence is not a factor.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•