Author: Oscar Cronquist Article last updated on May 21, 2022

The DATEDIF function returns the number of days, months, or years between two dates. The DATEDIF function exists in order to ensure compatibility with Louts 1-2-3.

Be careful with this function, there are cases where the DATEDIF may return unreliable results.

Formula in cell D3:


Formula in cell D4:


Formula in cell D5:


Formula in cell D6:


Formula in cell D7:


Excel Function Syntax


Note, this function shows no arguments in the formula bar.


start_date Required. The beginning date of the range you want to calculate.
end_date Required. The ending date of the period.
unit Required. This determines what the function returns. See table below.


Unit Output
"Y" Complete years in the range.
"M" Complete months in the range.
"D" Days in the range.
"MD" Months and years of the dates are ignored. Don't use this argument, may return incorrect results.
"YM" Returns months. Days and years of the date arguments are ignored.
"YD" Returns days. The years of the date arguments are ignored.


Don't use the "MD" argument.