# What is DATEDIF in Excel

DATEDIF in Excel is a date function which is used to obtain the difference between two given dates. These differences in given dates can be in years,  months or days. It requires two dates as an arguments and a keyword to specify which type of difference is desired for the output.

In short, DATEDIF function helps to calculate the number of days, months, or years between two given dates.

#### Syntax

DATEDIF(start_date,end_date,unit)

1. Start date – the begining date of the period.
2. Unit: The time unit in which we want the information while ascertaining the difference between two dates.
3. End date – the ending date of the period.

## Number of Units Available

• 1 – Y : Y used in a formula is to find out the number of complete years between start date and end date. The result is the number of complete years in the given period.
• 2 – M : used in a formula is to find the number of complete months between start date and end date. The result is the number of complete months in the given period.
• 3 – D : D used in a formula is to find the number of days between the start date and end date. The result is the number of complete Days in the given period.
• 4 – MD : MD used in a formula is to calculate the difference between the days in start date and end date. The months and years are ignored.
• It 5 – YD : YD used in a formula is to calculate the difference between the days in start date and end date. The dates and years are ignored here.
• 6 – YM : YM used in a formula is to calculate the difference between the months in start date and end date. The days and years are ignored here.

## Example – Number of days between the two dates

• Use the following data to find the number of days between 2 given dates.

Then, enter DATEDIF formula in the first row, using D (for days) as a unit in a formula.

Now press Enter. You will get the difference in days between the two given dates.

Now, if you will drag the formula, you will get the difference in days as a result for all the dates.

Note: DATEDIF is not a part of functions library as it is not a standard function. DATEDIF function is helpful to its users in order to support older workbooks from Lotus 1-2-3. DATEDIF function in excel is compatible with excel 2000 and previous versions of excel also.