+ Reply to Thread
Results 1 to 7 of 7

Using TODAY() in IF function

  1. #1
    Registered User
    Join Date
    11-24-2008
    Location
    Kenmore, WA
    Posts
    8

    Using TODAY() in IF function

    Hi,
    I am trying to set up a formula that will look at a column of dates i have and give me a "1" if that date is after today's date and leave the cell blank if it is not.
    I have tried =IF(X4<=TODAY(),1,"") but it gives me this error;
    "Please enter a valid date between 1/1/2005 and 12/31/2099 in the format mm/dd/yyyy"
    if i take off the "" it works but any false's print the word FALSE in the cell instead of leaving it blank.

    This is supposed to go with another column that does the same, but for dates before today, so i can sort expirations.

    I really appreciate any ideas how i could get this to work.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492
    Your formula works for me (excel 2003). Perhaps post an excerpt of your sheet so we can see yours and why it's not working.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    11-24-2008
    Location
    Kenmore, WA
    Posts
    8
    How should i post an excerpt? just copy a few rows and paste them in a reply?

  4. #4
    Registered User
    Join Date
    11-24-2008
    Location
    Kenmore, WA
    Posts
    8
    Better idea, here is a few rows copy-pasted into a new sheet.
    My equations will be going in the Z & AA columns.
    Attached Files Attached Files

  5. #5
    Forum Contributor mewingkitty's Avatar
    Join Date
    09-29-2008
    Location
    Fort McMurray, Alberta, Canada
    MS-Off Ver
    Excel 2003
    Posts
    949

    Formatting?

    I experienced the same problem you did after opening your workbook. Deleting the original cells in Z and AA and then putting your code back in there again got it working.

    Your code works! Just gotta get the cells set up properly methinks.

  6. #6
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678
    You need to delete the data validation in those cells, or change it to Custom, Formula is: =IF(Z4="", TRUE, AND(Z4>0, INT(Z4)=Z4))

    Then you can change the cell formula to =IF(X4 <= TODAY(), 1, "")
    Entia non sunt multiplicanda sine necessitate

  7. #7
    Registered User
    Join Date
    11-24-2008
    Location
    Kenmore, WA
    Posts
    8
    Cool, thanks. mewingkitty's advice worked and it seems to be working fine.
    Thank you all!

+ 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