DATEDIF Function
The DATEDIF function is one of the date and time functions. It is used to return the difference between two date values (start date and end date), based on the interval (unit) specified.
Syntax
DATEDIF(start_date, end_date, unit)
The DATEDIF function has the following arguments:
Argument |
Description |
start_date |
The starting date of a period. |
end_date |
The ending date of a period. |
unit |
The specified interval. The possible values are listed in the table below. |
The unit argument can be one of the following:
Unit |
Interval Explanation |
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 are ignored). |
Notes
If the start_date is greater than the end_date, the result will be #NUM!.
How to apply the DATEDIF function.
Examples
There are three arguments: start-date = A1 = 3/16/2018; end-date = A2 = 9/16/2018; unit = "D". So the function returns the difference between two dates in days.
![DATEDIF Function](https://test-helpcenter.onlyoffice.com/OfficeWeb/apps/spreadsheeteditor/main/resources/help/en/images/datedif.png)
Return to previous page