Results 1 to 4 of 4

Thread: [RESOLVED] Excel and nested IF's

  1. #1

    Thread Starter
    Member
    Join Date
    Mar 2006
    Posts
    36

    Resolved [RESOLVED] Excel and nested IF's

    Hi, just a question on nested if's, I assume there are only so many nested if statements you can use (8?) but I need to check on around 20 cells values before updating the current cell with a specific value, is there another way of doing this;

    One of my cells has the following, and due to the limitations of the IF statement I can't then calculate on the remaining cells

    =IF(Sheet1!$C$10=A3,"Apples",IF(Sheet2!$C10=A3,"Pears",IF(Sheet3!$C10=A3,"Oranges",IF(Sheet4!$C10=A3 ,"Plums",IF(Sheet1!$C15=A3,"Apples",IF(Sheet2!$C15=A3,"Pears",IF(Sheet3!$C15=A3,"Oranges",IF(Sheet4! $C15=A3,"Plums",""))))))))

    On sheets 1 to 4 I have around 20 cells I need to check if they are equal to the value presented to A3 on sheet5, similarly this is then used to check other values on sheet5.

    Hope I've made myself clear, and someone can help, regards

  2. #2
    Frenzied Member DKenny's Avatar
    Join Date
    Sep 2005
    Location
    on the good ship oblivion..
    Posts
    1,171

    Re: Excel and nested IF's

    You could use an OR statement for each possible output, but it is limited to 30 possible options.

    =IF(OR(Sheet1!$C$10=A3,Sheet1!$C15=A3,etc,etc),"Apples",IF(OR(Sheet2!$C10=A3,Sheet2!$C15=A3,etc,etc) ,"Pears",IF(OR(....
    Declan

    Don't forget to mark your Thread as resolved.
    Take a moment to rate posts that you think are helpful

  3. #3
    Frenzied Member Spajeoly's Avatar
    Join Date
    Mar 2003
    Location
    Utah
    Posts
    1,068

    Re: Excel and nested IF's

    Use a Select case since you know which cells you're looking at... You can nest ifs in those as well as Or's.

    Edited to add.....

    I am thinking in VBA, but it will still work.
    VB Code:
    1. Select Case Range Sheet1.Range("$C$10") 'Eh, I think that's right...
    2.  
    3. Case "Apples"
    4.  
    5. Case "Plums"
    6.  
    7. Case "Etc."
    8.  
    9. End Select
    Last edited by Spajeoly; Apr 11th, 2006 at 04:16 AM.

  4. #4

    Thread Starter
    Member
    Join Date
    Mar 2006
    Posts
    36

    Re: Excel and nested IF's

    Hi, thanks for the replies, the IF(OR works well and I think everything is working fine, thanks again for the replies and help

Posting Permissions

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



Click Here to Expand Forum to Full Width