+ Reply to Thread
Results 1 to 4 of 4

Need to show if difference between two dates is more than 30 days (after or before)

  1. #1
    Registered User
    Join Date
    08-27-2013
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    13

    Need to show if difference between two dates is more than 30 days (after or before)

    Hello excel experts!

    I'm trying to create a formula that will show me if two separate dates, have more than 30 days between them (whether it be 30 days before OR after), but disregarding the year. So for instance, in column B, line 2 (of the attached document), there's a date of 12/18/12, and in column C a date of 12/22/15. Because 12/18 is only 4 days before 12/22 (remember, we're disregarding the year), this information would be "correct", and wouldn't need to be marked.

    I work for a non-profit and the info is for homeless agencies that have to do an annual followup assessments with their clients (within 30 days of client anniversary), so thanks for any help on this! It will be going to a good cause
    Attached Files Attached Files

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

    Re: Need to show if difference between two dates is more than 30 days (after or before)

    Try

    in D2
    =ABS(B2-DATE(YEAR(B2),MONTH(C2),DAY(C2)))
    and copy down the column

    NOTE: I haven't allowed for a leap year day that may occur if one of the dates is a leap year.
    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 Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    30,983

    Re: Need to show if difference between two dates is more than 30 days (after or before)

    Try

    =IF(DATE(2016,MONTH(C2),DAY(C2))-DATE(2016,MONTH(B2),DAY(B2))<30,"Correct","")

    I just used 2016 as the year to simplify the calculation.

    .... just realised it will fail when dates fall over a year end.

    Special-K 's approach better.
    Last edited by JohnTopley; 06-21-2016 at 11:27 AM.

  4. #4
    Registered User
    Join Date
    08-27-2013
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    13

    Re: Need to show if difference between two dates is more than 30 days (after or before)

    1st suggestion:
    This sort of works, the only thing it's not doing is if the assessment date is BEFORE the enrollment date, it counts the difference the "long way", such as:

    18189 1/4/2012 12:00 AM 12/22/2015 12:00 AM 353 Instead of "18".



    2nd suggestion:
    This doesn't work on some cases, such as:
    16770 9/19/2013 12:00 AM 6/13/2016 12:00 AM Correct
    Last edited by jonmagee; 06-21-2016 at 02:19 PM.

+ 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. How to find the difference between 2 dates in days
    By nav505 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-11-2013, 07:45 AM
  2. Difference between two dates in months and days
    By pleiadeez7 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-24-2013, 01:54 PM
  3. Difference between two dates in week and days
    By newbiekinsey in forum Excel General
    Replies: 8
    Last Post: 06-06-2011, 06:02 PM
  4. Formula that counts difference in days between two dates.
    By elmaco12 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 07-09-2008, 06:34 AM
  5. difference between dates in no. of days
    By JAYLOTT in forum Excel General
    Replies: 4
    Last Post: 06-07-2007, 04:53 AM
  6. [SOLVED] difference betwwen two dates in days
    By seven in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 05-15-2006, 05:10 AM
  7. difference between two dates in years, months and days.
    By ruby in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 04-04-2005, 12:06 PM
  8. How do I calculate difference in days & hours between two dates e.
    By probi2 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-12-2005, 12:06 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