MS Excel: DATEDIF Function (WS)
In Microsoft Excel, the DATEDIF function returns the difference between two date values, based on the interval specified.
The syntax for the DATEDIF function is:
DATEDIF( start_date, end_date, interval )
start_date and end_date are the two dates to calculate the difference between.
interval is the interval of time to use to calculate the difference between date1 and date2. Below is a list of valid interval values.
|Y||The number of complete years.|
|M||The number of complete months.|
|D||The number of days.|
|MD||The difference between the days (months and years are ignored).|
|YM||The difference between the months (days and years are ignored).|
|YD||The difference between the days (years and dates are ignored).|
- Excel 2000
Type of Function
- Worksheet function (WS)
Worksheet Function Example
Let's take a look at an example to see how you would use the DATEDIF function in a worksheet:
Based on the spreadsheet above, the DATEDIF function would return the following:
|=DATEDIF(A1, A2, "Y")||would return 1|
|=DATEDIF(A1, A3, "D")||would return 455|
|=DATEDIF(A1, A3, "YD")||would return 90|