Explanation
Ever needed to calculate someone’s retirement date?
Or figure out when a 30-year mortgage will end?
Or maybe you’re setting a contract expiration date?
In each case, you need a way to add years to a date.
And worse, the solution can fail in leap years.
Then, it addsnto the year and reassembles the components to a date.
The second method uses the EDATE function to adjust the date by expressing years as months.
Both methods are explained below.
But first, let’s look at why we can’t just add 365 days to a date.
Why not just add 365?
Before diving into the formulas, it’s important to understandhow Excel stores and handles dates.
As I write this on November 21, 2024, the date number is 45617.
While this may seem logical, the problem is not all years have 365 days.
Leap years have 366 days, so using 365 will be off by one day after every leap year.
Worse, the error compounds over time.
Dates far into the future could be off by days or even weeks.
We need a more robust method.
See the result in cell E12 for an example.
It’s based on the EDATE function.
EDATE is designed to move a date by a given number of months.
Notice the results are the same,except for the result in E12:
EDATE handles month-end dates intelligently.
The date in cell B12 is February 29, 2024.
The first method splits the date into parts, adjusts the year, and then reassembles the date.
The second method, using the EDATE function, shifts the date by a specified number of months.
Both methods work well.
Both can handle dates far into the future, as well as negative year adjustments.
YEAR Function
The Excel YEAR function returns the year component of a date as a 4-digit number.
you could use the DAY function to extract a day number from a date into a cell.