Syntax. DATEDIF(start_date,end_date,unit)
Definition. This function calculates the interval between a start and an end date (period) in years, months, or days.
Arguments
start_date (required). The start date of the period.
end_date (required). The end date of the period.
unit (required). The unit type returned. The following units are available:
Y returns the number of whole years within the period.
M returns the number of whole months within the period.
D returns the number of days within the period.
MD returns the number of days between the two dates as if the dates were in the same month and year
YM returns the number of months between the two dates as if the dates were in the same year
YD returns the number of days between the two dates as if the dates were in the same year.
Background. This function calculates the interval between two dates (see Figure 7-1). You can enter all dates as strings enclosed in quotation marks, as serial numbers, or as the result of other formulas and functions.
Example. To calculate the employment period for employees up to a specified date, use the DATEDIF() function. For an employee hired on January 1, 2006, the calculation
=DATEDIF("01/01/2006","11/13/2011","Y")
returns 5
years for the period up to the date November 13, 2011. The formula
=DATEDIF("01/01/2006","11/30/2011","M")
calculates 70
months for the period up to November 13, 2011.