# If, and, or I've tried them all

#### jas64

##### New Member
I've tried all the functions and nested functions that I'm familiar with, but can't get it right. Below is what I'm looking for.

If condition #1 is true and condition #2 is true, then do formula "A". Or If condition #1 is true and condition #3 is true, then do formula "B". Or if condition #4 is true and condition #5 is true, then do formula "C". Or if condition #4 is true and condition #6 is true, then do formula "D".

 =IF(AL\$22=4, \$BB\$2="LOOSE",(2*.035*12) - OR - =IF(\$AL\$22=4, \$BB\$2="APPLIED",(3*.035*12) - OR - =IF(\$AL\$22=4, \$BB\$2="NONE",(2*.035*12) - OR - =IF(AL\$22=6, \$BB\$2="LOOSE",(2*.2*12) - OR - =IF(\$AL\$22=6, \$BB\$2="APPLIED",(3*.2*12) =IF(\$AL\$22=6, \$BB\$2="NONE",(2*.2*12)

<tbody>
</tbody>

<tbody>
</tbody>

#### jproffer

##### Well-known Member
I *think* this is what you're wanting...try it out and see....

Code:
``=IF(AND(\$AL\$22 = 4,OR(\$BB\$2="NONE",\$BB\$2="LOOSE")),(2*0.035*12),IF(AND(\$AL\$22=4,\$BB\$2="APPLIED"),(3*0.035*12),IF(AND(\$AL\$22=6,OR(\$BB\$2="NONE",\$BB\$2="LOOSE")),(2*0.2*12),IF(AND(\$AL\$22=6,\$BB\$2="APPLIED"),(3*0.2*12),"FALSE ON ALL ACCOUNTS"))))``
I left the (2*0.035*12) and other such formulas as you had them...figured you had some reason...but I can't imagine why you just don't do the math and have it return the answer. At any rate, HTH.

#### hotabae

##### Board Regular
 If condition #1 is true and condition #2 is true, then do formula "A". Or If condition #1 is true and condition #3 is true, then do formula "B". Or if condition #4 is true and condition #5 is true, then do formula "C". Or if condition #4 is true and condition #6 is true, then do formula "D".

<tbody>
</tbody>
This would appear something like this:

Code:
``=IF(AND(1,2),A,IF(AND(1,3),B,IF(AND(4,5),C,IF(AND(4,6),D,"FAIL CONDITION")``
I put "Fail condition" as a placeholder for whatever you want to happen if none of the 4 conditions are satisfied. (1,2) (1,3) (4,5) (4,6)

It would read something like this in the traditional sense: (the "value_if_false" portion of IF formula are basically ElseIf's)

Code:
``````If 1 = True and 2 = True Then
A

ElseIf 1 = True and 3 = True then
B

ElseIf 4 = True and 5 = True then
C

ElseIf 4 = True and 6 = True then
D

Else
"Fail Condition"

End If``````

Last edited:

#### jas64

##### New Member
Thanks for your input. The reason I don't just do the simple math, is this is in a long string of labor calculations that have more variables than I listed. I just wanted to get this base formula to work before I went too far.

#### jproffer

##### Well-known Member
I figured it was something like that .

If what I had didn't work, or if you can't adjust it on your own, just come on back...I'm happy to try again.

1,082,380
Messages
5,365,117
Members
400,824
Latest member
Themilkybarkid

### This Week's Hot Topics

• populate from drop list with multiple tables
Hi All, i have a drop list that displays data, what i want is when i select one of those from the list to populate text from different tables on...
• Find list of words from sheet2 in sheet1 before a comma and extract text vba
Hi Friends, Trying to find the solution on my task. But did not find suitable one to the need. Here is my query and sample file with details...
• Dynamic Formula entry - VBA code sought
Hello, really hope one of you experts can help with this - i've spent hours on this and getting no-where. .I have a set of data (more rows than...