ExcelFlux

DATEDIF function

Calculation — the number of days, months, or years between two dates. This function is useful in formulas where you need to calculate an age.

Date and time

Where can you use it?

Planning and operations teams. Use this group to work with dates and times in calendars, delivery schedules, shifts and period reporting.

Scenario in the workbook

Count completed years between two dates. A start date after the end is invalid.

A worked example from the workbook

RowAB
6InputSecond input
74383146023
84383144927
94602346023
Record 1
=DATEDIF(A7,B7,"Y")

Expected result6

See the inputs and instructions for all 3 examples

Copyable formulas

English Excel · en-US
=DATEDIF(A7,B7,"Y")
Turkish Excel · tr-TR
=TARİHFARKI(A7;B7;"Y")

Worked examples

Count completed years between two dates. A start date after the end is invalid.

Open the English sheet. Inputs begin at A6. F7:F9 show the live results and G7:G9 show the original results for comparison.

Row A B
6 Input Second input
7 43831 46023
8 43831 44927
9 46023 46023
Case Formula Expected result
Record 1 =DATEDIF(A7,B7,"Y") 6
Record 2 =DATEDIF(A8,B8,"Y") 3
Record 3 =DATEDIF(A9,B9,"Y") 0
Microsoft Excel reference