DATEDIF Function

About

The Excel DATEDIF function (Date + Difference) can be used to find the difference between two dates in ‘days’, ‘months’ or ‘years’.

Function Type

Date and Time

Purpose

Find the difference between two dates

Return value

Number representing the time period between two dates

Syntax

=DATEDIF (start_date, end_date, unit)

Arguments

start_date – A date representing the first, or starting date of a given period

end_date – A date representing the last, or end date of a given period

unit – Unit of time period. This can be Day, Month or Year. Given below are the different values that can be used in place this argument.

UnitResult
“D”Difference in Days
“M”Difference in Months
“Y”Difference in Years
“YD”Difference in Days, ignoring years
“YM”Difference in Months, ignoring days and years
“MD”Difference in Days, ignoring months and years

Example 1

Example 2


Notes

The DATEDIF function is a compatibility function and comes from Lotus 1-2-3. Unlike other functions Excel won’t help you fill the arguments of DATEDIF function.

Microsoft doesn’t recommend the use of “MD” value for unit because it may result in a negative number, a zero, or an inaccurate result.

If the start_date is greater than the end_date, the result will be #NUM! error


Read about Excel Functions

Excel Functions in Alphabetical Order (Complete list)

Complete List of Excel Functions (Category wise)


New Dynamic Array Functions in Excel

LET Function in Excel

STOCKHISTORY Function in Excel