Professional Documents
Culture Documents
https://www.vertex42.com/blog/excel-formulas/calculate-age-in-excel.html
This workbook contains examples from the article "Use DATEDIF to Calculate Age in Excel," plus some extra
article. Regarding copyright and sharing, think of this file like a book. You may use the ideas and techniques a
you may not reproduce this worksheet or copy substantial portions from it, just as you would not do so with a b
Interval Returns
"y" Number of whole years between two dates
"m" Number of whole months between two dates
"d" Number of days between two dates
"ym" Remaining number of whole months (derived from "y" and "m")
"yd" Remaining number of days after ignoring complete years
"md" Remaining number of days after adding complete years and months to the start
• Returns #NUM! if start_date > end_date or the interval is not in this list.
• The start_date and end_date arguments can be text. DATEDIF uses DATEVALUE to convert
• Dates cannot be pre-1900.
• DATEDIF(start,end,"ym") is derived from DATEDIF(start,end,"m")-12*DATEDIF(start,end,"y")
• Using the "md" interval sometimes results in negative values, so it should be avoided.
If you discover any typos or errors in this document, please contact me via the email listed on my website. Tha
EXAMPLE FORMULAS
Formula: =DATEDIF(birth_date,as_of_date,"y")
NOTE DATEDIF allows the start and end dates to be text. It uses the DATEVALUE function to conv
date values. The dates cannot be earlier than 1900.
NOTE To force an error when start > end, wrap the function with =IF(start>end,NA(),original_formu
count 2/29/2016 to 2/28/2017 as a whole year, you can add the following to this formula:
+IF( AND(MONTH(start)=2,DAY(start)=29,MONTH(end)=2,DAY(end)=28),1,0)
Method 3: Return a decimal number of years between two dates
CAUTION Using INT or ROUNDDOWN with this method to return the number of whole years between
to incorrect results (e.g. 28-Feb-2013 to 28-Feb-2016). This method is not a valid substitute
Formula: =YEARFRAC(start_date,end_date)
CAUTION Note that this formula returns an incorrect result for 31-Jul-2012 to 30-Jul-2015. Using INT o
method to return the number of whole years between two dates will sometimes lead to incor
to 28-Feb-2016).
Step 3: Calculate the remaining number of days after subtracting years and months from the end da
Using the "md" option for DATEDIF does not always give correct results.
The "md" option uses the method of returning remaining days after Adding whole months to the Start Dat
The following formula is a suggested work around on the Microsoft support site, but it is not correct.
ref: https://support.office.com/en-us/article/DATEDIF-function-25dba1a4-2812-480b-84dd-8b32a451b35c
The following formula correctly calculates remaining days after Subtracting whole months from the End D
Step 5: Substitute formulas for steps 1-3 into the formula in step 4
Formula:
=DATEDIF(start, end, "y") & "y " & DATEDIF(start, end,
"ym") & "m " & (DATE(YEAR(end), MONTH(end) -
DATEDIF(start,end,"m"), DAY(end))-start) & "d"
This method is based on the procedure of subtracting dates and ages by hand using the technique of writing d
DD. In elementary school, you learned when subtracting how to borrow from the tens or hundreds place when
borrow from the MM place, we subtract one from MM and then add 30 days to DD. If we need to borrow from
one from the YYYY place and add 12 to MM.
YYYY MM DD
Death 1980 03 07
- Birth 1931 05 12
= Age 48 09 25
Step 1: Subtract the days in the DD place, borrowing 30 days from the MM place if needed.
YYYY MM DD
Death 1980 02 37 (MM - 1, DD + 30)
- Birth 1931 05 12
= Age 25
NOTE Start with the day of the end date, then add 30 days if you need to borrow, then subtract the
may try to convert the result to a date, so change the number format back to General.
Step 2: Subtract the months in the MM place, borrowing 12 months from the YY place if needed.
YYYY MM DD
Death 1979 14 37 (YYYY - 1, MM + 12)
- Birth 1931 05 12
= Age 09 25
NOTE Start with the month of the end date, then subtract 1 if you had to borrow 30 days, then add
borrow from the years, then subtract the month of the start date.
YYYY MM DD
Death 1979 14 37
- Birth 1931 05 12
= Age 48 09 25
NOTE Start with the year of the end date, then subtract 1 if you had to borrow 12 months, then sub
Although the result is a monster formula, it is possible to return the age in 48y 9m 25d within a single formula.
NOTE Method 2 results in a different age than Method 1 about 32% of the time, but only by 2 days
methods return the exact same number of years and months. It is only the number of days t
Method 3: Calculate Age Using the 30-Day Month Method and YYYYMMDD
If you enter dates as numeric values in the format YYYYMMDD, then you can use the 30-day method (also kn
subtract the dates and the result will be the age in YYYYMMDD format. After subtracting the start date from th
subtract 70, and if MM > 12, subtract 8800. You can then use a custom number format of 0"y "00"m "00"d" t
example, I've used the number format that does not display years or months if they are zero.
NOTE Use the following custom number format for YYYYMMDD age values to only display the yea
zero: [>9999]0"y "00"m "00"d";[>99]0"m "00"d";0"d"
NOTE For an age stored as a YYYYMMDD value, use =VALUE(RIGHT(yyyymmdd,2)) to return the
=VALUE(RIGHT(INT(yyyymmdd/100),2)) to return the months and use =INT(yyyymmdd/100
Method 4: Use the fact that one year = 365.2422 days and one month = 30.
This method calculates the years wrong about 0.15% of the time (occasionally when the day/month are the sa
The reason I am listing it here is only academic - because this is the only method I'm aware of that is complete
BOTH the original end date and the original birth date can be calculated from the years, months and days.
This method calculates the years wrong about 0.15% of the time (occasionally when the day/month are the sa
The reason I am listing it here is only academic - because this is the only method I'm aware of that is complete
BOTH the original end date and the original birth date can be calculated from the years, months and days.
Years: =INT((end-start)/365.2422)
Months: =INT(MOD(end-start,365.2422)/30.43685)
Days: =INT(MOD(end-start,30.43685))
Calculate the Birthdate if you Know the Death Date and Age
Use DATE to subtract a combination of years, months and days from an end date. Whether the answer is corr
methodology used to calculate the age.
Formula: =DATE(YEAR(end_date)-years,MONTH(end_date)-
months,DAY(end_date)-days)
Calculate the Death Date if you Know the Birthdate and Age
Use DATE to add a combination of years, months and days to a start date. Whether the answer is correct dep
used to calculate the age.
Formula: =DATE(YEAR(start_date)+years,MONTH(start_date)
+months,DAY(start_date)+days)
Calculate Number of Months Between Two Dates
Method 1: Using DATEDIF(start,end,"m")
Formula: =DATEDIF(start_date,end_date,"m")
NOTE Whole months and years are only counted if DAY(end_date) is greater than or equal to DAY
month or year. This means that DATEDIF returns 0 months between 1/31/2016 and 2/28/20
2/29/2016 and 2/28/2017, even though all these dates are the end of the month. DATEDIF r
1/1/2000 and 1/31/2000 because the dates are in the same month.
NOTE If both dates are the end of the month, then you may want to treat the difference between th
formula handles that situation. This formula may be useful in situations involving bills or pay
always at the end of the month.
Calculate Number of Weeks Between Two Dates
Formula: =DATEDIF(start_date,end_date,"d")
Formula: =DAYS(end_date,start_date)
NOTE Using DATEDIF or DAYS allows the start_date and end_date to be text instead of date valu
than the year 1900.
REFERENCES
m")-12*DATEDIF(start,end,"y")
so it should be avoided.
Result
5y 11m 1d
MM place if needed.
of the time, but only by 2 days at most. Turns out that both
. It is only the number of days that may be different.
Y(date),"00"))
e values to only display the years and months if they are not
when the day/month are the same for the start and end dates).
od I'm aware of that is completely reversible - meaning that
he years, months and days.
Start Date End Date Years Months Days
31-Mar-2014 1-Mar-2020 5 11 0
29-Feb-2016 28-Feb-2018 1 11 29
28-Feb-2013 28-Feb-2016 2 11 29
t_date)/7.
oose should depend on how you want to handle the fact that
e a negative number of months, they will be subtracted from
31-Mar-2017 -1 28-Feb-2017
31-Mar-2017 1 30-Apr-2017
31-Mar-2017 -1 28-Feb-2017
31-Mar-2017 1 30-Apr-2017
31-Mar-2017 -1 3-Mar-2017
31-Mar-2017 1 1-May-2017
Days
25
29
25
10
Calculate Age in Excel - Examples
By Vertex42.com
https://www.vertex42.com/blog/excel-formulas/use-datedif-to-calculate-age-in-excel.html
Please review the following license agreement to learn how you may or may
not use this file. Thank you.
https://www.vertex42.com/licensing/EULA_privateuse.html