SOLVED

combining IF statements

Copper Contributor

I'm trying to combine the following IF statements into 1:

=IF(AND(B18<>$D$2, L18>=0), VLOOKUP(B18,$D$2:$E$5,2,FALSE),VLOOKUP(B18,$D$2:$F$5,3,FALSE))

&

=IF(AND(B20=$D$2, L20>$F$2), VLOOKUP(B20,$D$2:$E$5,2,FALSE),VLOOKUP(B20,$D$2:$F$5,3,FALSE))

 

The 1st statement reads: FOR POB <> SUB AND DISCOUNT IS >=0, RETURN 33% (VLOOKUP) IF NOT RETURN 0% (VLOOKUP)

 

The 2nd statement reads: IF POB = SUB AND DISCOUNT IS > -1%, RETURN 33 % (VLOOKUP), IF NOT RETURN -1% (VLOOKUP)

 

6 Replies
2 IF statements can be added/chained together but you need to decide how:
IF( condition1, true 1 result, IF( condition2, true 2 result, ...
in the example you gave both IF statements have both true and false calculations so what priority do you need to chain or waterfall the IF statements?
Thanks for the response! I would say the 2nd statement would take priority. How would that change the formula if I were to combine?
I didn't explain well and I don't know you data either. So in abstract terms I see:
IF( it is after 5pm, go home, otherwise stay at work)
IF( I'm tired, go to sleep, otherwise go to gym)
now combine them
well do I only do the 2nd if I go home? how do I combine those conditions?
I see what you mean. I think I'm trying to say:
IF (it is 5PM AND dark at night, go home, otherwise stay at work)
OR
IF (if it is not 5PM AND daylight, go home, otherwise stay at work)

Is it possible to combine?

best response confirmed by sahmad510 (Copper Contributor)
Solution
Ahhh wait, this could be even easier than I thought. so quick question:
In the examples, will cell references B18 & L18 vs B20 & L20 become the SAME cells? If so then assuming everything for Row 18 then try:
=IF(OR( AND(B18<>$D$2, L18>=0), AND(B18=$D$2, L18>$F$2) ), VLOOKUP(B18,$D$2:$E$5,2,FALSE),VLOOKUP(B18,$D$2:$F$5,3,FALSE))

YES IT WORKED!!! Thank you soooo much!!!! This is exactly what I was trying to do!!!
1 best response

Accepted Solutions
best response confirmed by sahmad510 (Copper Contributor)
Solution
Ahhh wait, this could be even easier than I thought. so quick question:
In the examples, will cell references B18 & L18 vs B20 & L20 become the SAME cells? If so then assuming everything for Row 18 then try:
=IF(OR( AND(B18<>$D$2, L18>=0), AND(B18=$D$2, L18>$F$2) ), VLOOKUP(B18,$D$2:$E$5,2,FALSE),VLOOKUP(B18,$D$2:$F$5,3,FALSE))

View solution in original post