What DATEDIF does
DATEDIF measures the gap between two dates. It is especially useful when you need the answer in whole years, whole months, or whole days instead of a simple raw subtraction.
Practical examples
Count full years
=DATEDIF(A2,B2,"Y")
This returns the number of complete years between the two dates.
Split a span into years, months, and days
DATEDIF can also return the leftover months or days after removing full years. That makes it a common choice for age calculations and tenure breakdowns.
Common mistakes and notes
Start date must be earlier
If the dates are reversed, DATEDIF can return errors or unexpected results.
Unit codes are strings
The unit argument must be in quotes, such as "Y" or "D".