'Excel IF and AND with 4 outputs

I'm trying yo update an IF function but get an error highlighting "E41"

I have the following which works fine:

=IF(AND(E41<B9,(B9-E41)<=E36,E31>=B9),"Yes, remaining d is sufficient",IF(E31<B9,"d limits DF range",IF(E41>=B9,"L not limiting DF range")))

The new 4th condition is added below but gives an error:

(the text within the " and " is different but this isn't the cause of the problem!)

=IF(AND(E41<B9,(B9-E41)<=E36,E31>=B9),"Yes, remaining d is sufficient",IF(E31<B9,"d limits DF range",IF(E41>=B9,"L not limiting DF range")),IF(B9-E41)>E36,"Insufficient d after L runs out"))

My four cases and the conditions are therefore:

If E31<B9 - display "d limits DF range"

If E41>B9 - display "L not limiting DF range"

If E41<B9 and (B9-E41)=<E36 and E31 >=B9 - display "Yes remainging d is sufficient"

New condition is to take into account extra option of

If E41<B9 and (B9-E41)>E36 then display "insufficient d once L runs out"

Any help most gratefully received! Trying to get the syntax understood still!

thanks!!!



Solution 1:[1]

Multiple Conditions Excel Formula

=IF(AND(E41<B9,B9-E41<=E36,E31>=B9),"Yes, remaining d is sufficient",IF(E31<B9,"d limits DF range",IF(E41>=B9,"L not limiting DF range",IF(B9-E41>E36,"Insufficient d after L runs out"))))

Compare

=IF(AND(E41<B9,B9-E41<=E36,E31>=B9),"Yes, remaining d is sufficient",IF(E31<B9,"d limits DF range",IF(E41>=B9,"L not limiting DF range",IF(B9-E41>E36,"Insufficient d after L runs out"))))
=IF(AND(E41<B9,(B9-E41)<=E36,E31>=B9),"Yes, remaining d is sufficient",IF(E31<B9,"d limits DF range",IF(E41>=B9,"L not limiting DF range")),IF(B9-E41)>E36,"Insufficient d after L runs out"))

Solution 2:[2]

Try this:

=IF(AND(E41=B9),"Yes, remaining d is sufficient",IF(E31=B9,"L not limiting DF range",IF(B9-E41)>E36,"Insufficient d after L runs out","None is True")))) Cheers Tim

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 VBasic2008
Solution 2