+ Reply to Thread
Results 1 to 5 of 5

How many IF functions can you have?

  1. #1
    heater
    Guest

    How many IF functions can you have?

    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.

  2. #2
    SimonCC
    Guest

    RE: How many IF functions can you have?

    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


    "heater" wrote:

    > 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.


  3. #3
    Bernard Liengme
    Guest

    Re: How many IF functions can you have?

    You can next function (including IF) to 7 levels only
    --
    Bernard V Liengme
    www.stfx.ca/people/bliengme
    remove caps from email

    "heater" <[email protected]> wrote in message
    news:[email protected]...
    >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.




  4. #4
    heater
    Guest

    RE: How many IF functions can you have?

    I came up with a different solution. I was making it way to complicated -
    Thanks!

    "SimonCC" wrote:

    > 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
    >
    >
    > "heater" wrote:
    >
    > > 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.


  5. #5
    Registered User
    Join Date
    06-28-2006
    Posts
    29
    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 32 if cells S, U, W, & Y32 =YES. It does this correctly. In your next if statement (next condition) you tell excel to total cell C32 if cell U32 is blank. It does this correctly because condition 1 is now no longer true. In you next condition you telling excel to contidict it's self by saying IF cell U32 equals YES, then total cells Z and AA 32. By putting Yes back in cell U32 unless I'm missing something now tell excel to 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 need to use =CONCATENATE. This will give you 30 conditions to use in your formula. There is also a way to bypass the 30 conditions but thats another story. Try to be a little more specific as to what you want the outcome to be. Hope this helps.

    Ed

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1