How DATEDIF works
Syntax
=DATEDIF(start_date, end_date, unit)start_date- The earlier date, such as a birthday or hire date.
end_date- The later date. Use TODAY() for "as of today".
unit- "Y" whole years, "M" whole months, "D" days, "YM" months left over after the years, "MD" days left over after the months.
Example
An employee's start date is in B2. You want "3 years, 4 months" of service.
=DATEDIF(B2, TODAY(), "Y") & " years, " & DATEDIF(B2, TODAY(), "YM") & " months"Shows the complete years and the months on top, such as 3 years, 4 months.
Common mistakes
- Putting the dates in the wrong order. If the start is after the end you get #NUM!.
- Dates stored as text, like "15/08/1990" typed in the wrong order for your settings. Check they line up to the right, which means they are real dates.
- Expecting autocomplete in Excel. DATEDIF is an older, undocumented function, so type it in full.
Questions people ask
How do I calculate age in Excel?
Use =DATEDIF(B2, TODAY(), "Y") with the birthday in B2. It counts only birthdays that have already happened.
Is there an alternative to DATEDIF?
=INT(YEARFRAC(B2, TODAY())) gives whole years too.
Practice it above: type the formula in the formula bar and press Enter to check.