The DATEDIF
function returns the difference between two date values, based on the interval specified. It is provided for compatibility with Lotus 1-2-3. The DATEDIF
function cannot be found on the function list and autocomplete and screen tips are unavailable. Note: It is pronounced "date diff" rather than "dated if".
=datedif("2010-01-01","2016-07-21","D")
returns the number of days (2393) between the two dates
=datedif("2010-01-01","2016-07-21","M")
returns the number of months (78) between the two dates
=datedif("2010-01-01","2016-07-21","Y")
returns the number of years (6) between the two dates
=datedif("2010-01-01","2016-07-21","MD")
returns the number of days (20) between the two dates-ignoring the months and years
=datedif("2010-01-01","2016-07-21","YM")
returns the number of months (6) between the two dates-ignoring the years
=datedif("2010-01-01","2016-07-21","YD")
returns the number of days (201) between the two dates-ignoring the years