+ Reply to Thread
Results 1 to 13 of 13

Check two dates against todays date?

  1. #1
    Registered User
    Join Date
    03-24-2010
    Location
    Oslo, Norway
    MS-Off Ver
    Excel 2003
    Posts
    20

    Check two dates against todays date?

    Hey,

    I have a issue I can't seem to get working. I have two cells that contain two different dates. I would like to check if any of these cells have a data later than today’s date. If any of the two have a later date than today I wanth it to say OK, if not NOT OK.
    This is what I have tried:

    =IF(OR(B2>TODAY;C2>TODAY);"OK";"NOT OK")

    This gives me the #NAME? result.

    How should I go about fixing this formula?

    Thanks in advance!

    Ole

  2. #2
    Forum Expert
    Join Date
    12-23-2006
    Location
    germany
    MS-Off Ver
    XL2003 / 2007 / 2010
    Posts
    6,326

    Re: Check two dates against todays date?

    replace TODAY with today() ( XL has a help function, use it)

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

    Re: Check two dates against todays date?

    You can also use this: =IF(MAX(B2;C2)>TODAY();"OK";"NOT OK")
    Never use Merged Cells in Excel

  4. #4
    Registered User
    Join Date
    03-24-2010
    Location
    Oslo, Norway
    MS-Off Ver
    Excel 2003
    Posts
    20

    Re: Check two dates against todays date?

    SOLVED: Needed to enter TODAY with ()

    =IF(OR(B2>TODAY();C2>TODAY());"OK";"NOT OK")

  5. #5
    Registered User
    Join Date
    03-24-2010
    Location
    Oslo, Norway
    MS-Off Ver
    Excel 2003
    Posts
    20

    Re: Check two dates against todays date?

    Thanks for all the answers. But I have a new problem which makes my formula more complex.

    I also want to check if cell B2 or cell C2 have a date value. In some cases these cells can have a #N/A value. If so is the case I dont won't the formula to check these cells. I want the formula only to check the cell with a date and then check if this date is later than today.

  6. #6
    Registered User
    Join Date
    03-24-2010
    Location
    Oslo, Norway
    MS-Off Ver
    Excel 2003
    Posts
    20

    Re: Check two dates against todays date?

    I have uploaded a file that explains better
    Attached Files Attached Files

  7. #7
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    16,043

    Re: Check two dates against todays date?

    Did you test my formula?

    Also, for #N/A maybe you could solve cause of what making you error.

  8. #8
    Registered User
    Join Date
    03-24-2010
    Location
    Oslo, Norway
    MS-Off Ver
    Excel 2003
    Posts
    20

    Re: Check two dates against todays date?

    zbor, no I didnt try your formula. But when I did it worked like a charm

    Thanks a lot!

  9. #9
    Registered User
    Join Date
    03-24-2010
    Location
    Oslo, Norway
    MS-Off Ver
    Excel 2003
    Posts
    20

    Re: Check two dates against todays date?

    Quote Originally Posted by zbor View Post
    Did you test my formula?

    Also, for #N/A maybe you could solve cause of what making you error.
    It seems like I was a bit hasty. It seems like the formula works when the value of the cell is a standard text, but as soon as the value of one of the cells is #N/A the formula will only show you #N/A despite one of the cells having a date value later than today.

    Is it perhaps possible to check if a cell contains a date value? If it contains a date value I can get this value and transfer it to another cell and then do the operation in two steps?

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

    Re: Check two dates against todays date?

    It's possible, but can you remove error from your previous cell?

    In other words what cause you error?

    If some formula return you error in xl 2003 you can use:

    =IF(ISERROR(formula), "", formula)

    So this one will work. But we would need know more about what causing error

  11. #11
    Registered User
    Join Date
    03-24-2010
    Location
    Oslo, Norway
    MS-Off Ver
    Excel 2003
    Posts
    20

    Re: Check two dates against todays date?

    Quote Originally Posted by zbor View Post
    It's possible, but can you remove error from your previous cell?

    In other words what cause you error?

    If some formula return you error in xl 2003 you can use:

    =IF(ISERROR(formula), "", formula)

    So this one will work. But we would need know more about what causing error
    Ok. The error is caused by a =vlookup formula. I am checking to se if a value is present in another sheet. If the value is noe present the vlookup formula sends away a #N/A error message. Can i maybe make the vlookyp formula to give me anther value if value looked up is not found?

  12. #12
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    16,043

    Re: Check two dates against todays date?

    You can do this: =IF(ISNA(MATCH( value, vlookup_array, 0), "No match found", VLOOKUP(...))

  13. #13
    Registered User
    Join Date
    03-24-2010
    Location
    Oslo, Norway
    MS-Off Ver
    Excel 2003
    Posts
    20

    Re: Check two dates against todays date?

    Quote Originally Posted by zbor View Post
    You can do this: =IF(ISNA(MATCH( value, vlookup_array, 0), "No match found", VLOOKUP(...))
    I finally solved it

    I used a combination of your two suggestions.

    I used this one to to make my =vlookup into 0 if #N/A
    =IF(ISNA(VLOOKUP(AE2;CRM!$A$31:$F$84;6;FALSE));0;VLOOKUP(AE2;CRM!$A$31:$F$84;6;FALSE))

    And then I compared the two dates against each other using the formula under:

    =IF(MAX(AI2:AJ2)>TODAY();"TRUE";"FALSE")

    Thank you very much!

+ 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