Date and time

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 reference

Search ExcelTutor