We require calculating the difference between two dates for many purposes in our daily life. Excel consists of many functions that easily calculate the difference between two dates.
Mostly this difference is required for Payroll purposes for calculating the number of days worked in a month for preparing salaries.
In Accounting, it is required for knowing due dates of payments and in HR for employee benefits.
You can use the DATEDIF function to easily calculate the difference between two dates. With this function, you can calculate the difference in days, weeks, months and years.
Let us understand it with an example.
Copy below data in your worksheet and copy it in 2 times.
Start Date End Date
5/4/2015 4/3/2017
Note: Please make sure that the format of the cell is set to date format.
In C1 put the heading Difference. In C2 put an equal sign and insert the DATEDIF Function. The DATEDIF function has 3 arguments in the syntax.
=DATEDIF(Start_Date, End_Date, Unit)
You can either put the dates directly in the formula or use cell reference. Choose the desired unit. “Y” for the year, “M” for the month and “D” for days.
1. Finding the difference in Number of days
Formula with Dates: =DATEDIF(5/4/2015, 4/3/2017, “D”).
OR
Formula with Cell Reference: =DATEDIF(A2,B2, “D”)
The result will be 700 days. To calculate the difference in weeks, just divide the whole formula with 7. =DATEDIF(A2, B2, “D”)/7
2. Finding the difference in Months
Formula with Dates: =DATEDIF(5/4/2015, 4/3/2017, “M”).
OR
Formula with Cell Reference: =DATEDIF(A2,B2, “M”).
Here you get the result as 22 months.
3. Finding the difference in Years
Formula with Dates: =DATEDIF(5/4/2015, 4/3/2017, “Y”).
OR
Formula with Cell Reference: =DATEDIF(A2,B2, “Y”).
You get the result as 1 year. This function counts the number of full years between the dates. This is how you can use the DATEDIF function to calculate the difference between two dates
To learn other functions like MID, QUOTIENT and KURT Functions, please click on the name of the function.
We thank our readers for liking, sharing and following us on different social media platforms.
If you have any queries please share in the comment section below. I will be more than happy to assist you.
Scott Farris says
It would be nice to show an example using “today()” in the “datedif” function. Often people need to find difference between today and some starting point.
Fahim Lashkaria says
Hey Scott, thanks for the suggestion. Will include it in the article with example.