# How to Use DATEDIF Function in Excel (6 Suitable Examples)

Get FREE Advanced Excel Exercises with Solutions!

MS Excel users often need to calculate the difference between two particular dates. The difference can be in days or months, or years. The DATEDIF function allows users to calculate the difference in any unit. So, in this article, we will show how to use DATEDIF function in Excel with suitable examples.

## Introduction to Excel DATEDIF Function

The DATEDIF function determines how many days, months, or years there are between two dates. It uses an initial date and a final date as the first two arguments to calculate the difference, and finally, it takes a unit that defines whether the difference will be in days or months or years.

• Generic Syntax

DATEDIF(start_date,end_date,unit)

• Argument Description
ARGUMENT REQUIREMENT EXPLANATION
start_date Required This the date that serves as the initial date or the beginning of a particular period.
end_date  Required This is the final date of the particular period.
unit  Required This is the type of information that you want the formula to return.

## 6 Suitable Examples of Using DATEDIF Function in Excel

In this section, we will demonstrate the usage of the DATEDIF function with 6 suitable examples.

### 1. Calculating Differences in Days Between Two Dates

In this instance, we will use the DATEDIF function to calculate the difference between two dates in days.

Steps:

• Firstly, click on the D5 cell and write the following formula,
`=DATEDIF(B5,C5,"d")`
• Then, hit Enter. • As a result, we will have a difference in days unit.
• Finally, lower the cursor to fill the rest of the data cells. ### 2. Evaluating Differences in Months Between Two Dates

In this example, we will apply the DATEDIF function to determine the difference between two dates in months.

Steps:

• To begin with, click on the D5 cell and write the following formula,
`=DATEDIF(B5,C5,"m")`
• Then, press Enter. • Consequently, we will have a difference in months unit.
• Finally, move the cursor down to fill the rest of the data cells. ### 3. Determining Differences in Years Between Two Dates

In this illustration, we will utilize the DATEDIF function to evaluate the difference between two dates in years.

Steps:

• To start with, select the D5 cell and write down the following formula,
`=DATEDIF(B5,C5,"y")`
• Then, hit the Enter button. • As a result, we will get a difference in years unit.
• Finally, lower the cursor to auto-fill the rest of the datasets. ### 4. Estimating Differences in Days Ignoring Months and Years

In this demonstration, we will use the DATEDIF function to calculate the difference between two dates in days, ignoring the months and years.

Steps:

• Firstly, choose the D5 cell and type the following formula,
`=DATEDIF(B5,C5,"md")`
• Then, press Enter. • Consequently, we will find a difference in days after ignoring the months and years while calculating.
• Finally, lower the cursor to the last data cell to get results according to the formula. ### 5. Calculating Differences in Months Ignoring Years

In this instance, we will apply the DATEDIF function to estimate the difference between two dates in months, ignoring the years.

Steps:

• Firstly, choose the D5 cell and write the following formula down,
`=DATEDIF(B5,C5,"ym")`
• Then, press the Enter button. • Consequently, we will find a difference in months after ignoring the years while calculating.
• Finally, move the cursor down to the last data cell to get results according to the formula. ### 6. Evaluating Differences in Days Ignoring Years

In this final example, we will utilize the DATEDIF function to calculate the difference between two dates in days, ignoring years.

Steps:

• To begin with, click on the D5 cell and type the following formula,
`=DATEDIF(B5,C5,"yd")`
• Then, press Enter. • Consequently, we will find a difference in days after ignoring the years while calculating.
• Finally, lower the cursor to the last data cell to get results in accordance with the formula. ## Conclusion

In this article, we have discussed 6 proper examples of how to use the DATEDIF function in Excel. So, this will allow users to find the difference between any two dates in any unit they like. If you find it useful, please let us know in the comment section below and share any recommendations and thoughts regarding this or any other content of ours. Thank you for your time. Follow ExcelDemy.com for more articles like this.

## Related Articles #### Taryn Nefdt

Taryn is a Microsoft Certified Professional, who has used Office Applications such as Excel and Access extensively, in her interdisciplinary academic career and work experience. She has a background in biochemistry, Geographical Information Systems (GIS), and biofuels. She enjoys showcasing the functionality of Excel in various disciplines. She has over ten years of experience using Excel and Access to create advanced integrated solutions.

We will be happy to hear your thoughts Advanced Excel Exercises with Solutions PDF  