+ Reply to Thread
Results 1 to 6 of 6

IF OR Statement with Dates

  1. #1
    Forum Contributor Webbers's Avatar
    Join Date
    09-06-2005
    Location
    Poinciana, FL
    MS-Off Ver
    Microsoft Office 365 ProPlus
    Posts
    337

    IF OR Statement with Dates

    Hi all! This one has been driving me nuts! I have a report that is pulled from a database, and by default if a date cell is left blank, then a value is listed. Oddly enough, normally these "blank default" dates are consistent, but for some reason, I have 2 of them in 2 different formats. Perhaps, this is due to a blank field or 0 being entered in the system. In any even the two bogus dates are:

    1800-01-01
    1/1/1900

    As you can see, two different formats. I am trying to write an if statement that if either of those 2 dates is listed, to display "No", and if any other date is listed, to display "Yes". The date is in column K. My formula was to use a nested IF/OR statement, but it would seem I do not have it correct. I wrote it as:

    =IF(OR(K2="1800-01-01",K2="1/1/1900"),”No”, "Yes")

    However, it lists Yes for everything, except where it lists "#NAME?". None of the cells in this column are actually blank, and all other dates are valid dates. I just need to be able to flag all these bog dates, and I cannot figure out what I am doing wrong. Thanks so much!.
    ~*~ Sherry ~*~
    Poinciana, FL

  2. #2
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,064

    Re: IF OR Statement with Dates

    Try
    =IF(OR(K2="1800-01-01",K2=DATEVALUE("1/1/1900")),”No”, "Yes")
    Regards
    Special-K

    Ensure you describe your problem clearly, I have little time available to solve these problems and do not appreciate numerous changes to them.

  3. #3
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: IF OR Statement with Dates

    1800-01-01 defaults to a text value so I am not sure why that is appearing in your import.
    1/1/1900 is actually the number 1 in date format. So the value being imported is 1.

    Not sure we can help more than that without seeing the data and where you want to put your IF statement.
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  4. #4
    Forum Contributor Webbers's Avatar
    Join Date
    09-06-2005
    Location
    Poinciana, FL
    MS-Off Ver
    Microsoft Office 365 ProPlus
    Posts
    337

    Re: IF OR Statement with Dates

    Quote Originally Posted by Special-K View Post
    Try
    =IF(OR(K2="1800-01-01",K2=DATEVALUE("1/1/1900")),”No”, "Yes")
    I tried, and this formula still results in a #NAME? error where the date field has a value of 1800-01-01

  5. #5
    Valued Forum Contributor nigelbloomy's Avatar
    Join Date
    11-06-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    1,011

    Re: IF OR Statement with Dates

    Somehow the quotes around the word "No" were wrong in the formula from SpecialK. Try this one:
    Please Login or Register  to view this content.
    Some people volunteer in soup kitchens or hospitals. I choose to make the world better by trying to help you with Excel. We're all learning.

    <---Click * Add Reputation for all helpful comments. It's like giving a smile.
    Forum Rules: How to mark your post [Solved] and have a happier, Excel enriched life.

  6. #6
    Forum Contributor Webbers's Avatar
    Join Date
    09-06-2005
    Location
    Poinciana, FL
    MS-Off Ver
    Microsoft Office 365 ProPlus
    Posts
    337

    Re: IF OR Statement with Dates

    Quote Originally Posted by nigelbloomy View Post
    Somehow the quotes around the word "No" were wrong in the formula from SpecialK. Try this one:
    Please Login or Register  to view this content.
    Thanks Nigel, it works perfect now! And thank Special-K for your help as well!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. If Statement and dates
    By Cageyj0nny in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-11-2014, 08:03 AM
  2. IF Statement If Between these dates = this
    By Galbraith in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-30-2013, 01:31 PM
  3. using dates in IF statement
    By bigchuda in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 08-28-2008, 02:55 PM
  4. Dates and if statement
    By FSCGunslinger in forum Excel General
    Replies: 7
    Last Post: 02-12-2008, 08:39 AM
  5. [SOLVED] IF statement with two dates
    By jbormann in forum Excel General
    Replies: 2
    Last Post: 07-18-2006, 12:32 PM

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