• Home
  • DATEDIF Function

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:

ArgumentDescription
start_dateThe starting date of a period.
end_dateThe ending date of a period.
unitThe specified interval. The possible values are listed in the table below.

The unit argument can be one of the following:

UnitInterval Explanation
YThe number of complete years.
MThe number of complete months.
DThe number of days.
MDThe difference between the days (months and years are ignored).
YMThe difference between the months (days and years are ignored).
YDThe 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

Host ONLYOFFICE Docs on your own server or use it in the cloud

Article with the tag:
Browse all tags