The result is a date 60 years (720 months) from the date of birth in column C. Note: At the time of this writing, the current date is September 2, 2021. This is the date used to calculate the remaining years in column F. The date comes from column C. For months, we need the equivalent of 60 years in months. Since most people don’t know how many months are in 60 years, a nice way to do this is to embed the calculation in the formula like this: Inside the EDATE function, Excel will perform the math and return 720 directly to EDATE as the months argument. Embedding calculations this way can help make the assumptions and purpose of a formula easier to understand. To use a retirement age of 65, just adjust the calculation: In cell D5, returns the date March 10, 2023. As the formula is copied down column D, a different date is returned for each person in the list based on their birthdate. Note: EDATE returns a date as a serial number, so apply a date number format to display as a date.
End of month
To calculate a retirement date that lands on the end of the month, you can use the EOMONTH function instead of the EDATE function like this: EOMONTH works like EDATE, but always returns the end of the month. If there is a rule that people with birthdays that fall on the first of the month retire on the last day of the previous month, the formula can be adjusted like this: Here, the logical expression DAY(C5)=1 is subtracted from 12*60 = 720. The DAY function returns the day of the birthdate. If the day is 1, the expression returns TRUE. Otherwise, the expression returns FALSE. The math operation of subtraction coerces TRUE to 1 and FALSE to zero. The result is that EOMONTH moves forward 719 months if a birthday falls on the first of the month, and 720 months if not. This moves first-of-month birthdays to the last day of the previous month.
Year only
To return the retirement year only, we can nest EDATE inside the YEAR function like this: Since we already have the date in column D, the formula in column E is: The YEAR function returns the year of the date returned by EDATE.
Years remaining
In column F, we calculate the years remaining with the YEARFRAC function like this: This formula returns the difference between today’s date and the calculated retirement date in column D. As the retirement date approaches, the years remaining will automatically decrease. To guard against a retirement date that is already passed, the formula in column F uses the SIGN function to change years remaining to a negative number like this: The SIGN function simply returns the sign of a number as 1, -1, or 0. To use it, we subtract today’s date from the retirement date. If the result is positive, the retirement date is in the future and SIGN returns 1, which does not affect the result from YEARFRAC. If the result is negative, the retirement date is in the past and SIGN returns -1, flipping the YEARFRAC calculation to a negative number. You can see the result in row 8, where the retirement date has already passed.
Other uses
This same approach can be used to calculate dates for a wide variety of use cases:
Warranty expiration dates Membership expiration dates Promotional period end date Shelf life expiration Inspection dates Certification expiration
Dave Bruns
Hi - I’m Dave Bruns, and I run Exceljet with my wife, Lisa. Our goal is to help you work faster in Excel. We create short videos, and clear examples of formulas, functions, pivot tables, conditional formatting, and charts.