+ Reply to Thread
Results 1 to 6 of 6

Less than date

  1. #1
    Registered User
    Join Date
    06-21-2009
    Location
    Sydney
    MS-Off Ver
    Excel 2003
    Posts
    7

    Less than date

    Trying to get a cell to return a zero is a date is less than 1/1/2010, but it is not working as it returns zero even if I enter a date after 1/1/2010. Here is what I have:

    =IF(L9="","",IF(J9<"1/1/2010",0,L9*(1+M9)))

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

    Re: Less than date

    The way your formula is written you are comparing the cell to a Text value of "01/01/2010" ... Text is always > Numbers... and dates are Numbers, so either:

    a) coerce the string to a number

    =IF(L9="","",IF(J9<0+"1/1/2010",0,L9*(1+M9)))

    b) use DATE function

    =IF(L9="","",IF(J9<DATE(2010,1,1),0,L9*(1+M9)))

  3. #3
    Forum Contributor
    Join Date
    04-03-2007
    Location
    Auckland, New Zealand
    MS-Off Ver
    2007
    Posts
    137

    Re: Less than date

    Quote Originally Posted by philosman View Post
    Trying to get a cell to return a zero is a date is less than 1/1/2010, but it is not working as it returns zero even if I enter a date after 1/1/2010. Here is what I have:

    =IF(L9="","",IF(J9<"1/1/2010",0,L9*(1+M9)))
    Your formula treats the date as text.
    Excel stores dates as numbers.

    Try putting 1/1/2010 in a cell and then change the cell format to number to see what I mean.

    you could rewrite your formula as :

    =IF(ISBLANK(L9),0,IF(J9<40179,0,L9*(1+M9))))

    Note: I changed the "" evaluation to test if L9 is empty and if true then the formula result is 0 (zero)

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

    Re: Less than date

    I think it's fair to say that if OP wanted to return 0 result for L9 being Null/Blank as opposed to a Null (as was implied in the original formula) then you need not use an IF at all:

    =(N(L9)*(1+M9))*(J9>=DATE(2010,1,1))

  5. #5
    Registered User
    Join Date
    06-21-2009
    Location
    Sydney
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: Less than date

    Quote Originally Posted by Stormseed View Post
    Welcome to Exceltip forum.
    try,

    =IF(J9<DATE(2010,1,1),0,L9*(1+M9))
    This works great ! Thanks.

    Also thanks to the other replies for helping me understand WHY mine didn't work

+ 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