Online datedif calculator


The mysterious datedif function in Microsoft Excel

The Datedif function is used to calculate interval between two dates in days, months or years.

This function is available in all versions of Excel but is not documented. It is not even listed in the "Insert Function" dialog box.
Hence it must be typed manually in the formula box.


DATEDIF( start_date, end_date, interval_unit )

start_date from date
end_date to date (must be after start_date)
interval_unit Unit to be used for output interval

Values for interval_unit

interval_unit Description
D Number of days
M Number of complete months
Y Number of complete years
YD Number of days excluding years
MD Number of days excluding months and years
YM Number of months excluding years


Error Description
#NUM! The end_date is later than (greater than) the start_date
or interval_unit has an invalid value.
#VALUE! end_date or start_date is invalid.


datedif function examples