excel DATEDIF function

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Insert
> Step 2: And Like the video. BONUS: You can also share it!

Syntax

  • =DATEDIF(start_date,end_date,unit)

Parameters

UnitReturns
"Y"The number of complete years in the period
"M"The number of complete months in the period
"D"The number of days in the period
"MD"The difference between the days in start_date and end_date. The months and years of the dates are ignored
"YM"The difference between the months in start_date and end_date. The days and years of the dates are ignored
"YD"The difference between the days of start_date and end_date. The years of the dates are ignored

Remarks

Be careful of Leap Year calculations when the units ignore years. For example:

=datedif("2010-01-01","2010-07-21","YD")

returns 201 days

=datedif("2016-01-01","2016-07-21","YD")

returns 202 days



Got any excel Question?