**Table of Contents**

## DATEDIF Function in Excel

The Excel DATEIF function gives the difference between the two date values in months, years or days.

#### The Formula used for Finding the Difference Between Two Values in Excel is Mention Below:

**DATEDIF(start_date, end_date, unit)**

- Start_date – the initial date of the period you want to calculate.
- Unit: The time unit to utilize while ascertaining the difference between two dates.
- End_date – the ending date of the period.

#### Number of Units Available for DATEDIF in Excel

**#1 – Y**(Years): Y used in a formula to find the number of complete years between beginning and end dates.**#2 – M**(Months): used in a formula to find the number of complete months between the dates.**#3 – D**(Days): D used in a formula to find the Number of days between the begin date and end date.**#4 – MD (**Days barring years and months): MD used in a formula to find the date contrast in days, disregarding months and years.**#5 – YD**(Days barring years): YD used in a formula to find the date contrast in days, disregarding years.**#6 – YM**(Months barring days and years): YM used in a formula to find the date contrast in months, disregarding days and years.

### How to use the DATEDIF Function in Excel?

Select the data to find the difference:

#### DATEDIF Function in Excel Example #1

**Number of days between the two dates**

- Use the following data to find the no. of days between 2 dates.

- Enter DATEDIF formula in the first row, use D as a unit in a formula.

- Press Enter, you will find the difference in days between the two dates

- Now if we will drag the formula, we will get the result for all the dates. Please find the same in the figure shown below.

#### DATEDIF Function in Excel Example #2

**Count the number of days ignoring years**

- Use the following data to find the no. of days ignoring years.

- Enter DATEDIF Formula in the first row, use YD as a unit in a formula.

- Press Enter, you will find the difference in days between the two dates.

- Now if we will drag the formula, we will get the result for all the dates. Please find the same in the figure shown below.

#### DATEDIF Function in Excel Example #3

**Count the number of months between the two dates**

- Use the following data to find a number of months between the two dates.

- Enter DATEDIF Formula in the first row, use M as a unit in a formula

- Press Enter, you will find the difference in days between the two dates in excel.

- Now if we will drag the formula, we will get the result for all the dates. Please find the same in the figure shown below.

#### DATEDIF Function in Excel Example #4

**Find the days excluding years and months.**

- Use the following data to find the days excluding years and months.

- Enter DATEDIF Formula in the first row, use MD as a unit in a formula

- Press Enter, you will find the difference in days between the two dates.

#### DATEDIF Function in Excel Example #5

**Find the days excluding days and years.**

- Use the following data to find the days excluding days and years

- Enter DATEDIF Formula in the first row, use YM as a unit in a formula

- Press Enter, you will find the days excluding days and years.

#### DATEDIF Function in Excel Example #6

**Find the years.**

- Use the following data to find the years between the two dates

- Enter DATEDIF Formula in the first row, use Y as a unit in a formula

- Press Enter, you will find the years between the two dates.

### Advantages of DATEDIF Function in Excel

- DATEDIF in excel is very easy to use if you find the difference between the two dates.
- If you want to find the difference between a number of days, week or month, use this formula.
- DATEDIF helps you find the difference between the six parameters.
- DATEDIF is so simple because of simplicity it can be used in many of the cases if the unit is a day, year or month.
- The user needs this function only when it requires more controls.

### Disadvantages of DATEDIF Function in Excel

- DATEDIF formula in excel supports only six types of interval or able to help to find the difference among between only six types of units.
- It cannot control so many types of units like the first day of the week.
- Sometimes this function leads to complexity if you only want to find the difference among day, month or years.
- Sometime it may lead to confusion because of so many parameters used in one formula.
- DATEDIF formula in excel only gives you the formula if you are using the correct date format.

**Things to remember about DATEDIF Function in Excel**

- For the DATEDIF formula in excel to figure months accurately, the end date should be greater than the start date; otherwise, the formula the give the error the #NUM error.
- The outcomes returned by DATEDIF and YEAR/MONTH formulas are not constantly indistinguishable in light of the fact that they work dependent on various standards. The Excel DATEDIF work restores the number of complete calendar months between the dates, while the YEAR/MONTH equation works on months’ numbers.
- Always select the correct Unit in a formula.
- Excel will not help you to give instruction to fill DATEDIF formula like other functions.
- It is also recommended that, don’t use MD as units because sometimes it gives a negative value.
- Always make sure to use data format while calculating the difference between the values.
- DATEDIF formula in excel is also useful while you are the calculating the age.
- When excel does not recognize the date given, it results in the #Value!error because excel won’t understand the data argument.

You can download this DATEIF Function in Excel template here – DATEDIF Function Excel Template

### Recommended Articles

This has been a guide to DATEDIF in Excel. Here we discuss how to use DATEDIF function along with excel examples and downloadable excel templates. You may also look at these useful functions in excel –

## Leave a Reply