# Excel Function : DATEDIF

## Excel Function : DATEDIF

Date and time

###### Description

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 and Description of the DATEDIF Excel Function

The DATEDIF function calculates the number of days, months, or years between two dates. The syntax for the DATEDIF function is as follows: =DATEDIF(date1,date2,interval) The date1 and date2 parameters are mandatory and must be valid dates. The interval parameter is optional and takes the following values: d: Days m: Months y: Years The following screenshot shows the DATEDIF function being used to calculate the number of days between two dates: The following screenshot shows the DATEDIF function being used to calculate the number of months between two dates: The following screenshot shows the DATEDIF

## About DATEDIF Excel Function

The DATEDIF function calculates the number of days, months, or years between two dates. DATEDIF(start_date, end_date, unit) start_date - The start date. end_date - The end date. unit - The unit of time that you want to use to calculate the difference. Can be one of the following values: "D" - Days "M" - Months "Y" - Years