The Excel DATEDIF function (Date + Difference) can be used to find the difference between two dates in ‘days’, ‘months’ or ‘years’.
Date and Time
Find the difference between two dates
Number representing the time period between two dates
=DATEDIF (start_date, end_date, unit)
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.
|“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|
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