[]
        
(Showing Draft Content)

DATEDIF

This function returns the number of days, months, or years between two dates.

Syntax

DATEDIF(date1, date2, outputcode)

Arguments

This function has these arguments:

Argument

Description

 date1

[Required] The starting date, as a string, numeric value, or DateTime object.

 date2

[Required] The ending date, as a string, numeric value, or DateTime object.

outputcode

[Required] A string code that specifies the unit of difference ("D","M","Y","YD","YM","MD").

The output codes are:

Code

Description

"D"

The number of days between date1 and date2

"M"

The number of complete months between date1 and date2

"Y"

The number of complete years between date1 and date2

"YD"

The number of days between date1 and date2 as if they were in the same year

"YM"

The number of months between date1 and date2 as if they were in the same year

"MD"

The number of days between date1 and date2 as if they were in the same month and year

Examples

DATEDIF(A1,B1,C1)

DATEDIF(R1C1,R1C2,R1C3)