Use DateDiff Excel Worksheet Function

DATEDIFF function calculates difference between 2 dates in a variety of different intervals.
This function is not present in the Microsoft Excel documentation, but it is widely used in the spreadsheet models.
DATEDIFF ( Date1, Date2, Interval )
Parameters
  • Date1 - first date
  • Date2 - second date
  • Interval - defines type of the interval to return
Interval could be one of the following values:
  • m - (Month) Complete calendar month
  • d - (Days) Number of days
  • y - (Years) Complete calendar years
  • ym - (Month in the same year) the number of months between 2 dates if there were in the same year
  • yd - (Days in the same year) the number of days between 2 dates if there were in the same year
  • md - (Days in the same month and year) the number of days if the were in the same month and year