# How to use DATEDIF Function in Excel

In this tutorial, we will be learning about the DATEIF function in Excel. This function is a simple yet powerful tool that can help you calculate the difference between two dates in days, weeks, months, and years. It is especially useful for determining the number of days or months that have passed since a specific event or date.

In this article, we will be going over the basic usage of the DATEIF function and how to use it to find the difference in years, months, and days.

## Step-by-Step Instructions

1. The first step is to open up a new Excel sheet and input the data that you want to use for your calculations. In this example, we will be using a demo data set that includes the names and dates of birth of employees, as well as their join and retirement dates.
2. The next step is to enter the DATEIF formula into the appropriate cell. To do this, simply type “=DATEDIF” and then open the parenthesis.
3. The basic functionality of the DATEIF function is to calculate the number of days, weeks, years, or months between two dates in Excel. To find the difference in years between the two dates, you need to enter the join date, followed by a comma and the retirement date. For the third argument, you need to enter the abbreviation “Y” for years. In our case, the formula will =DATEIF (D2,E2,”Y”). 4. To find the difference in months, you will need to enter the same join and retirement dates and then change the third argument to “M” for months. This will give you the number of months between the two dates. In our case, the formula will =DATEIF (D2,E2,”M”)
5. To find the difference in days, you will again enter the same join and retirement dates and change the third argument to “D” for days. This will give you the number of days between the two dates. In our case, the formula will =DATEIF (D2,E2,”D”)

## Conclusion

With the step-by-step instructions provided in this article, you should now have a good understanding of how to use the DATEIF function in Excel. To acknowledge more advanced uses of the DATEIF function, check out our video on this topic.