DATEDIF
Measure completed years, months or days between two dates using a unit code.
Syntax
=DATEDIF(start_date, end_date, unit)Worked example
Count completed years one day before the fifth anniversary.
=DATEDIF(DATE(2021,3,9),DATE(2026,3,8),"Y")Result 4
Microsoft documentation
Check the arguments, supported editions and behavior of this function in Microsoft’s reference.
Microsoft referenceExcel DATEDIF Function | Excel One Minute Functions Explained
Practice DATEDIF
Count completed years one day before the fifth anniversary.
| A | B | |
|---|---|---|
| 1 | ||
| 2 | ||
| 3 | ||
| 4 |
Show example formula
=DATEDIF(B2,B3,B4) Lesson quiz
Answer three questions to see your level in this lesson.
