+ Reply to Thread
Results 1 to 5 of 5

Nested if (and

  1. #1
    Registered User
    Join Date
    02-23-2010
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    17

    Nested if (and

    Hi there,

    Any help would be much appreciated.

    =IF($F26>0,0,+IF(AND($H26>0,M$1>=$H26),$L26)+IF(AND($H26<0,M$1>=$K26),$L26))

    I'm struggling to get the following to work. It seems to pick up the first IF and the second IF (AND) however it totally disregards the last IF statement.

    Basically the way it should work is: If F26 is 0, put in a 0, otherwise if H26 is greater than 0 and M1 is greater than H26 the put in L26, otherwise IF H26 is less than 0 and M1 is greater than K26 then put in L26

    Any suggestions??

  2. #2
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: Nested if (and

    aaron,

    lose the "+" sign. It's not needed in Excel and is only testament of previous Lotus 123 usage.

    I'm not sure what you're trying to achieve, but maybe:

    =IF($F26>0,0,IF(AND($H26>0,M$1>=$H26),$L26,IF(AND($H26<0,M$1>=$K26),$L26)))

  3. #3
    Registered User
    Join Date
    02-23-2010
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    17

    Re: Nested if (and

    Hi,

    =IF($F26>0,0,IF(AND($H26>0,M$1>=$H26),$L26,IF(AND($H26<0,M$1>=$K26),$L26,"")))

    Lost the +, then I get an error, so I put the "" at the end of the function (so if false) and it still seems to disregard the last statement. Basically (so he says) if F26 is greater than 0 do nothing, if not then do the other 2 IF (AND) statements.

  4. #4
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: Nested if (and

    Lost the +, then I get an error,
    what error?

    post a workbook and explain what you are trying to achieve.

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

    Re: Nested if (and

    Quote Originally Posted by aron.silan
    Basically the way it should work is: If F26 is 0, put in a 0, otherwise if H26 is greater than 0 and M1 is greater than H26 the put in L26, otherwise IF H26 is less than 0 and M1 is greater than K26 then put in L26
    Perhaps:

    =IF($F26=0,0,IF(OR(AND($H26>0,M$1>=$H26),AND($H26<0,M$1>=$K26)),$L26,"?"))

    not clear what should happen if the conditions do not hold true (have entered ? - modify as desired)

+ 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