+ Reply to Thread
Results 1 to 2 of 2

Expiration Date with Edate accounting for leap years

  1. #1
    Registered User
    Join Date
    03-19-2021
    Location
    Kitchener, Ontario
    MS-Off Ver
    MS Office 2016
    Posts
    8

    Expiration Date with Edate accounting for leap years

    Using excel to indicate expiration dates by X # of months form the date of manufacture, but it does not accurately account for leap years.

    Formula is =EDATE(G3,18) (Where G3 is the manufacture date, and we want to add 18 months to get expiry). This usually works, however....

    March 30 2021 should yield an Expiry of Sept 30 2021 - which works with the EDATE function above.

    March 31 2021 should yield an Expiry of Oct 1 2021 (leap year!) - BUT it doesn't! It still yields Sept 30 2021 (so short 1 day)

    What am I doing wrong? Or how do we account for leap years when calculating expiration?

  2. #2
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,942

    Re: Expiration Date with Edate accounting for leap years

    That's not how date math works in Excel. The logic for figuring out the day return by EDATE is to use the minimum of

    =DAY(G3)

    And the last day of the new month

    =DAY(DATE(YEAR(G3),MONTH(G3)+19,0))

    So, if 18 months in the future is February of a non-leap year, any starting date day that is 28, 29, 30, or 31 will return 28

    If you want a specific number of days, then just use

    =G3+547

    547 is 18 months....
    Bernie Deitrick
    Excel MVP 2000-2010

+ 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. leap years and date calculation
    By Alaxus in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 06-16-2020, 09:34 AM
  2. Simple question - accounting for leap years in formulas calculating dates
    By Bretyuin in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 02-16-2017, 04:09 PM
  3. [SOLVED] Date function not accounting for leap year
    By SpencerD1985 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-19-2013, 05:48 AM
  4. [SOLVED] Age based on DOB; Accounts for leap years. Years old if >2, Months if <2 years old.
    By sharpmel in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 01-17-2013, 04:20 PM
  5. Date Differences and ignoring Leap Years
    By kieran54055 in forum Excel General
    Replies: 2
    Last Post: 09-20-2010, 11:51 AM
  6. Excel =Date and Leap Years
    By thesonofdarwin in forum Excel General
    Replies: 10
    Last Post: 06-15-2010, 03:31 AM
  7. Problem with displaying a date range for leap years
    By Parmo in forum Excel - New Users/Basics
    Replies: 2
    Last Post: 02-02-2007, 06:27 PM

Tags for this Thread

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