DATEDIF function
Summary
Calculates the number of days, months, or years between two dates. This function is useful in formulas where you need to calculate an age.
Syntax
DATEDIF(start_date,end_date,unit)
start_date Required | A date that represents the first, or starting date of a given period. Dates may be entered as text strings within quotation marks (for example, "2001/1/30"), as serial numbers (for example, 36921, which represents January 30, 2001, if you're using the 1900 date system), or as the results of other formulas or functions (for example, DATEVALUE("2001/1/30")).
end_date Required | A date that represents the last, or ending, date of the period.
Unit | The type of information that you want returned, where: Unit Returns "Y" The number of complete years in the period. "M" The number of complete months in the period. "D" The number of days in the period. "MD" The difference between the days in start_date and end_date. The months and years of the dates are ignored. Important: We don't recommend using the "MD" argument, as there are known limitations with it. See the known issues section below. "YM" The difference between the months in start_date and end_date. The days and years of the dates are ignored "YD" The difference between the days of start_date and end_date. The years of the dates are ignored. | "Y" | The number of complete years in the period. | "M" | The number of complete months in the period. | "D" | The number of days in the period. | "MD" | The difference between the days in start_date and end_date. The months and years of the dates are ignored. Important: We don't recommend using the "MD" argument, as there are known limitations with it. See the known issues section below. | "YM" | The difference between the months in start_date and end_date. The days and years of the dates are ignored | "YD" | The difference between the days of start_date and end_date. The years of the dates are ignored.
"Y" | The number of complete years in the period.
"M" | The number of complete months in the period.
"D" | The number of days in the period.
"MD" | The difference between the days in start_date and end_date. The months and years of the dates are ignored. Important: We don't recommend using the "MD" argument, as there are known limitations with it. See the known issues section below.
"YM" | The difference between the months in start_date and end_date. The days and years of the dates are ignored
"YD" | The difference between the days of start_date and end_date. The years of the dates are ignored.
end_date Required | A date that represents the last, or ending, date of the period.
Unit | The type of information that you want returned, where: Unit Returns "Y" The number of complete years in the period. "M" The number of complete months in the period. "D" The number of days in the period. "MD" The difference between the days in start_date and end_date. The months and years of the dates are ignored. Important: We don't recommend using the "MD" argument, as there are known limitations with it. See the known issues section below. "YM" The difference between the months in start_date and end_date. The days and years of the dates are ignored "YD" The difference between the days of start_date and end_date. The years of the dates are ignored. | "Y" | The number of complete years in the period. | "M" | The number of complete months in the period. | "D" | The number of days in the period. | "MD" | The difference between the days in start_date and end_date. The months and years of the dates are ignored. Important: We don't recommend using the "MD" argument, as there are known limitations with it. See the known issues section below. | "YM" | The difference between the months in start_date and end_date. The days and years of the dates are ignored | "YD" | The difference between the days of start_date and end_date. The years of the dates are ignored.
"Y" | The number of complete years in the period.
"M" | The number of complete months in the period.
"D" | The number of days in the period.
"MD" | The difference between the days in start_date and end_date. The months and years of the dates are ignored. Important: We don't recommend using the "MD" argument, as there are known limitations with it. See the known issues section below.
"YM" | The difference between the months in start_date and end_date. The days and years of the dates are ignored
"YD" | The difference between the days of start_date and end_date. The years of the dates are ignored.
Example
=DATEDIF(Start_date,End_date,"Y")
=DATEDIF(Start_date,End_date,"D")
=DATEDIF(Start_date,End_date,"YD")
=DATEDIF(Start_date,End_date,"D")
=DATEDIF(Start_date,End_date,"YD")