[Table of Contents] [docx version]
SpreadsheetML Reference Material - Table of Contents
DATEDIF ( start-date , end-date , unit )
Description: Calculates the number of days, months, or years between two dates.
Arguments:
Name |
Type |
Description | ||||||||||||||
start-date |
number |
The first date in the period, truncated to integer. | ||||||||||||||
end-date |
number |
The last date in the period, truncated to integer. | ||||||||||||||
unit |
The count to be returned, as follows:
|
Return Type and Value: number – The number of days, months, or years between two dates, depending on the value of unit.
However, if
• start-date or end-date is out of range for the current date base value, #NUM! is returned.
• start-date ≥ end-date #NUM! is returned.
• unit is any value other than those shown in the table above, #NUM! is returned.
[Example:
DATEDIF(DATE(2001,1,1),DATE(2003,1,1),"Y") results in 2 complete years
DATEDIF(DATE(2001,6,1),DATE(2002,8,15),"D") results in 440 days
DATEDIF(DATE(2001,6,1),DATE(2002,8,15),"YD") results in 75 days
DATEDIF(DATE(2001,6,1),DATE(2002,8,15),"MD") results in 14 days
end example]