+ Reply to Thread
Results 1 to 7 of 7

Thread: Using the "IF" Function with Dates

  1. #1
    Registered User
    Join Date
    08-22-2011
    Location
    Harrisburg, PA
    MS-Off Ver
    Excel 2007
    Posts
    8

    Using the "IF" Function with Dates

    Hello all,

    I spent all afternoon trying to figure out how to do this, but I couldn't. I am hoping someone out there can help!

    Anyways, I have two columns of data that are date fields (E.g., Column A is when Event A occurred and Column B is when Event B occurred). Not all rows of subjects have both dates entered in. For example, Event A may have occurred for the subject on 12/12/2008, but Event B never occurred, so Column B is left blank for that subject. Some rows have two dates filled in. For example, Event A may have occurred on 8/21/2009 and Event B may have occurred on 7/27/2007.

    I am trying to create and "IF" formula that will account for the following:

    1.) If only one event occurred, the date of the event populates (e.g., Event A occurred on 12/12/2008, Event B never occurred so it's corresponding cell is left blank, so 12/12/2008 shows up in the cell that has the function entered in)

    2.) If both events occurred, the date that the FIRST event occurred shows up in the cell that has the function entered. So, for example, Event A occurred on 8/21/2009 and Event B occurred on 7/27/2007, so 7/27/2007 shows up in the cell that has the function entered in.

    Any help is greatly appreciated! I am about to pull out my hair.

  2. #2
    Valued Forum Contributor tlafferty's Avatar
    Join Date
    04-08-2011
    Location
    United States, Tacoma, WA
    MS-Off Ver
    Excel 2010
    Posts
    856

    Re: Using the "IF" Function with Dates

    Please do not double post. See forum rules.
    If your question has been satisfactorily addressed, please consider marking it solved. Click here to see how.

    Also, you might want to add to the user's reputation by clicking the scales icon - it's why we do what we do...

    Thomas Lafferty
    Analyst/Programmer

  3. #3
    Registered User
    Join Date
    08-22-2011
    Location
    Harrisburg, PA
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: Using the "IF" Function with Dates

    Sorry, I only double posted because it was brought to my attention that I had posted the original thread in the wrong forum.

  4. #4
    Valued Forum Contributor
    Join Date
    11-11-2008
    Location
    Euro
    MS-Off Ver
    2003, 2007
    Posts
    384

    Re: Using the "IF" Function with Dates

    Try using the formula for cell C2
    =MIN(A2:B2)
    with Assuming:
    cell A2: the date of event A
    cell B2: the date of event B

    Copy fill down to C3,C4....
    Best regard, -)iger-/iger
    If you are pleased with a solution mark your post SOLVED.

  5. #5
    Registered User
    Join Date
    08-22-2011
    Location
    Harrisburg, PA
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: Using the "IF" Function with Dates

    That's a great suggestion; thank you! I will try it at work tomorrow. The only concern that I have is what is going to happen with the cells that are blank...i thought Excel read blank date fields as "0" (or 1/01/1900) and thus, the smallest value out of the two columns?

    So for example, Column A is empty, but Excel reads it as "0"/ 1/01/1900 and Column B reads 2/25/2005, I want 2/25/2005 to show up in the formula cell, but since Excel is reading Column A as 1/01/1900, that value will show up in the formula cell.

    Thanks again!

  6. #6
    Valued Forum Contributor
    Join Date
    11-11-2008
    Location
    Euro
    MS-Off Ver
    2003, 2007
    Posts
    384

    Re: Using the "IF" Function with Dates

    Don't worry about it because the MIN function in excel ignore the empty cell or cell containing the value "", the formula is tested for the cases by myself
    Best regard, -)iger-/iger
    If you are pleased with a solution mark your post SOLVED.

  7. #7
    Registered User
    Join Date
    08-22-2011
    Location
    Harrisburg, PA
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: Using the "IF" Function with Dates

    Thank you so much! Greatly appreciated.

+ 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.2.0