+ Reply to Thread
Results 1 to 5 of 5

Simple question - accounting for leap years in formulas calculating dates

  1. #1
    Registered User
    Join Date
    02-23-2016
    Location
    California
    MS-Off Ver
    Excel 2016
    Posts
    8

    Simple question - accounting for leap years in formulas calculating dates

    Hi,

    I have a simple formula that is calculating a date & the formula is using the number 365 to represent a year. I don't think the correct date will be calculated using this formula when a leap year is involved. How do I modify this simple formula to account for leap years and still calculate the correct dates? Please see attached file.

    Thanks for your help
    Attached Files Attached Files

  2. #2
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: Simple question - accounting for leap years in formulas calculating dates

    Try

    =IF($B2=1029,EDATE($A2,-12*1),IF($B2=1030,EDATE($A2,-12*2),IF($B2=1031,EDATE($A2,-12*5))))

  3. #3
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Simple question - accounting for leap years in formulas calculating dates

    In C2,

    =EDATE(A2, -12*LOOKUP(B2, {1029,1030,1031},{1,2,5}))
    Entia non sunt multiplicanda sine necessitate

  4. #4
    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,743

    Re: Simple question - accounting for leap years in formulas calculating dates

    Try

    =IF($B4=1029,DATE(YEAR($A4)-1,MONTH(A4),DAY(A4)),IF($B4=1030,DATE(YEAR($A4)-2,MONTH(A4),DAY(A4)),IF($B4=1031,DATE(YEAR($A4)-5,MONTH(A4),DAY(A4)))))

    If the anniversary is on the SAME month & day.

  5. #5
    Registered User
    Join Date
    02-23-2016
    Location
    California
    MS-Off Ver
    Excel 2016
    Posts
    8

    Re: Simple question - accounting for leap years in formulas calculating dates

    Thanks! Much appreciated!

+ 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. Calculating yearly start dates ignoring leap years
    By Steve S. in forum Excel General
    Replies: 4
    Last Post: 02-25-2015, 04:39 PM
  2. [SOLVED] Auto populate dates to figure in for leap years
    By SethS in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 08-08-2014, 06:49 AM
  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. Dates and Leap Years
    By JEA in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 10-05-2011, 11:03 PM
  6. Calculating Dates from Non Leap Seconds
    By Mac Lingo in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-18-2005, 11:05 PM
  7. Calculating days between dates and leap years
    By KimberlyC in forum Excel Programming / VBA / Macros
    Replies: 19
    Last Post: 03-17-2005, 12:06 AM

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