+ Reply to Thread
Results 1 to 10 of 10

Nested IF problems

  1. #1
    Registered User
    Join Date
    04-27-2009
    Location
    New Zealand
    MS-Off Ver
    Excel 2007
    Posts
    2

    Nested IF problems

    Hello,

    I am trying to figure out how to use nested if's but am unable to get it to work


    this is the formula i am using
    =IF(D4<B18,A19,IF(D4>B18<B17,A18,IF(D4>B17,A17)))

    here is a screen shot of how my spreadsheet is setup
    \1

    What am i doing wrong?



    any help much appreciated
    Thanks
    EE

  2. #2
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Nested IF problems

    =if(d4<b18,a19,if(d4<b17,a18,a17))
    no need for between conditions as each test is done in order so if its less than 50 fail if it passes that test i.e 50+ then the next test is applied "is it less than 80 " if its not then give end result
    what you were trying to write is this
    =IF(D4<b18,A19,IF(AND(D4>=b18,D4<b17),A18,A17))
    which is as mentioned above unecessary but it will still work
    Last edited by martindwilson; 04-27-2009 at 05:13 AM.
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

  3. #3
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,627

    Re: Nested IF problems

    try this:

    =IF(D4<$B$18;$A$19;IF(D4<$B$17;A18;A17))

    Edit: replace ; with ,
    Edit2: martindwilson well noticed mistake
    Last edited by zbor; 04-27-2009 at 05:21 AM.

  4. #4
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Nested IF problems

    zebor your point is? not only is that just reiterating what ive posted but it is also wrong!
    =IF(D4<B4

  5. #5
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,627

    Re: Nested IF problems

    Yes, you a right, didn't watch carefully.
    Also, when I posted this I didn't see you already post solution. Window was oppened, I tested formula and copy-paste it. If it's problem I'll remove it.

  6. #6
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Nested IF problems

    Another alternative to using an IF I've interpreted correctly:

    First enter 0 in to B19

    Then:

    D4: =INDEX($A$17:$A$19,4-COUNTIF($B$17:$B$19,"<="&B4))
    can be applied to E4:G4 and all rows below

    If you altered the ordering of your marks (from low to high) you could use a simpler method still, ie:

    A17: Fail: B17: 0
    A18: Pass Mark: B18: 50
    A19: Merit Mark: B19: 80

    D4: =LOOKUP(B4,$B$17:$B$19,$A$17:$A$19)
    can be applied across all result cells

  7. #7
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Nested IF problems

    zebor only joking with you.lol but it was a glaring typo!!!! i know what its like, someone asks a pivot table question ,you go away build the table find the answer post it in the still open window, only to find 10 others have already given the solution!
    Last edited by martindwilson; 04-27-2009 at 05:36 AM.

  8. #8
    Registered User
    Join Date
    04-27-2009
    Location
    New Zealand
    MS-Off Ver
    Excel 2007
    Posts
    2

    Re: Nested IF problems

    thanks all

    Martindwilson, your solution works perfectly after a little alteration being adding $$ to some of the cell references eg. $B$17 so it doesent change that cell as it goes down the marks

  9. #9
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,627

    Re: Nested IF problems

    Quote Originally Posted by martindwilson View Post
    zebor only joking with you.lol but it was a glaring typo!!!! i know what its like, someone asks a pivot table question ,you go away build the table find the answer post it in the still open window, only to find 10 others have already given the solution!
    Is that zebor thing also some joke I don't understand

  10. #10
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Nested IF problems

    Touché !My apologies Zbor

+ 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