How many IF functions can you have?

H

heater

I have the following formula:
=IF(AND(S32="Yes",U32="Yes",W32="Yes",Y32="Yes"),Z32+AA32+AB32+AC32,IF(U32="",Z32,IF(U32="Yes",Z32+AA32,IF(W32="",Z32+AA32,IF(W32="Yes",Z32+AA32+AB32,IF(Y32="",Z32+AA32+AB32,IF(Y32="Yes",Z32+AA32+AB32+AC32,IF(M32="No",0))))))))

The problem is when W32 is "Yes". It does not add the totals in Z32,AA32, &
AB32. However, when S32, U32, W32, & Y32 = "Yes", then the total of all four
cells totals the correct total. There probably is an easier formula.
 
S

SimonCC

The Excel limit for nested IF is 7. Looks like you're right at the limit, so
you'll be ok as long as you don't add another IF. Nothing happens when your
5th IF (W32="Yes") is true, because you have already covered all the
possibilities by the 3rd IF (U32="Yes"). So basically no matter what the
combination of your 4 cells are, it will not go any further than the 3rd IF.

Don't really know how to correct the formula because I don't know what's the
exact conditions you want. Maybe if you write it out in words I can figure
out the formula to use.

-Simon
 
P

patele

First of all you need to understand how excel makes it's calculations
In your formula you are telling excel to total cells Z, AA, AB, & AC 3
if cells S, U, W, & Y32 =YES. It does this correctly. In your next i
statement (next condition) you tell excel to total cell C32 if cell U3
is blank. It does this correctly because condition 1 is now no longe
true. In you next condition you telling excel to contidict it's self b
saying IF cell U32 equals YES, then total cells Z and AA 32. By puttin
Yes back in cell U32 unless I'm missing something now tell excel t
return to the first condition which should total 13 the sum of cells Z
AA, AB, & AC 32. You can have more than 7 nested if's however, you nee
to use =CONCATENATE. This will give you 30 conditions to use in you
formula. There is also a way to bypass the 30 conditions but that
another story. Try to be a little more specific as to what you want th
outcome to be. Hope this helps.

E
 
Top