For keeping track of an employee/student to check the progress, you may need to know the difference between two dates in days in Excel. Also, counting days are most important for tracking projects to meet a deadline.
Most of the time for time management, you need to know the difference between two dates. Also in our regular life, there are so many purposes for which we need to know the days between two dates.
In this article, we will see how Excel calculates difference between two dates in days. Below, we have attached an overview image so that you can understand today’s learning.
Download Practice Workbook
Download the following practice workbook. It will help you to realize the topic more clearly.
Excel Calculates Difference Between Two Dates in Days: 7 Ways
We’ll show you 7 quick methods of how Excel calculates the difference between two dates in days. To explain our methods, we’ve picked a dataset with 3 columns: “Name”, “Joining Date”, and “Resigning Date”. In all our methods, we’re gonna find the number of days each employee worked in a company.
1. Using DATEDIF Function to Find Difference Between Two Dates in Days
For the first method, we’re going to use the DATEDIF function to calculate the difference between two dates. This function is not listed in Excel, hence, no tooltip will be displayed for this function. We’ve added a column “Total Days” in our dataset.
- Type the following formula in cell E5 & press ENTER.
=DATEDIF(C5,D5,"d")
The syntax of this function is DATEDIF(start_date,end_date,unit). Our initial date is on cell C5, the end date is on cell D5. And finally, we’re setting our output format to days using “d” in the function.
We’ll see the date difference in days in cell E5.
- Finally, use the Fill Handle icon to AutoFill the formula to the rest of the cells.
Here you will see all the total days.
Calculating Days Ignoring Years from Dates
Here, we have used the following formula in the E5 cell.
=DATEDIF(C5,D5,"Yd")
Our initial date is on cell C5, the end date is on cell D5. We’re setting our output format to days using “Yd” in the function. So, the years will not be considered here. Which means days are counting from 01/March to 10/March.
We have used the same formula for the rest of the cells.
Read More: How to Calculate Time Difference in Excel Between Two Dates (7 Ways)
2. Use of DAYS Function to Find Date Difference in Days
For the second method, we’ll use the DAYS function to get the date difference in days.
- First, type the following formula in cell E5.
=DAYS(D5,C5)
The syntax of this function is “DAYS(end_date,start_date)”. Here, our end date is on cell D5 and the initial date is on cell C5.
- Finally, press ENTER and AutoFill the formula.
We can see this is the simpler version of the DATEDIF function.
3. Calculating Difference Between Two Dates in Days Using DAYS360 Function
In this section, we’re going to use the DAYS360 function to find the difference between two dates in days.
- Type the following formula in cell E5.
=DAYS360(C5,D5)
The syntax of this function is “DAYS360(start_date,end_date)”. Here, our initial date is on cell C5 and the end date is on cell D5.
- Press ENTER to get the result.
- AutoFill the formula for the rest of the cells.
Similar Readings
- Calculate Positive or Negative Difference Between Two Numbers in Excel
- How to Calculate Absolute Difference between Two Numbers in Excel
- Pivot Table: Percentage Difference between Two Columns
- How to Calculate Significant Difference Between Two Means in Excel
- Excel Pivot Table: Difference between Two Columns (3 Cases)
4. Using DATE Function to Find Days Between Two Dates
For the fourth method, we’ll use the YEAR, MONTH, DAY, and DATE functions to calculate the difference between two dates in Excel.
- Type the following formula in cell E5 >>press ENTER.
=DATE(YEAR(D5),MONTH(D5),DAY(D5))-DATE(YEAR(C5),MONTH(C5),DAY(C5))
Formula Breakdown
Firstly, our formula has two DATE functions. Finally, we’re subtracting the first date from the last date using those.
- YEAR(D5),MONTH(D5),DAY(D5) will return 2022, 5, 10 respectively.
- Now the first part of our formula reduces to -> DATE(2022,5,10)
- Output: 44691.
- Our output will be in a Serial Number format.
- Similarly, our second portion will return 44621.
- Finally, we’re subtracting it to get our date difference (44691-44621=70).
- AutoFill the formula for the rest of the cells.
Thus, we’ve found the difference between the two dates in days format.
5. Calculate Workdays Between Two Dates in Days in Excel
In the case of office dealing, you may need to exclude the weekends and general holidays from the total days. Basically, we’re talking about how you can calculate the workdays only.
To do so, there are two functions in Excel. One is the NETWORKDAYS function. And the other is the NETWORKDAYS.INTL function.
There is a basic difference, in the case of NETWOKDAYS function, the weekends will be Saturday and Sunday. Where NETWORKDAYS.INTL function can take weekends as an argument, so you can use different weekends.
5.1 Use of NETWORKDAYS Function to Count Workdays
In this method, we’re going to use the NETWORKDAYS function to find date differences in the day’s format. We’ve changed our dataset a little bit by adding 2 holidays.
- Type the following formula in cell E5.
=NETWORKDAYS(C5,D5,$C$13:$C$14)
The syntax of this function is “NETWORKDAYS(start_date, end_date, [holidays])”. Here, our initial date is on cell C5 and the end date is on cell D5 and our holidays are in cell range C13:C14. Moreover, remember to use absolute cell references in this function.
- Press ENTER.
Finally, AutoFill the formula. In conclusion, we’ll find the workdays in days between the dates.
5.2 Use of NETWORKDAYS.INTL Function
If you want to change the weekends, you need to use NETWORKDAYS.INTL function.
Here, you can choose the weekend according to your preference.
The syntax of this function is “NETWORKDAYS.INTL(start_date,end_date,[weekend],[holidays])”.
After giving the 2nd comma in the function, you will get a list to select the weekends. You can select any of them. Additionally, you have to create a holiday list.
So, the final formula is given below.
=NETWORKDAYS.INTL(C5,D5,1,$C$13:$C$26)
- Press ENTER to get the result >> then use the Fill Handle icon for the other cells.
6. Find Difference Between Two Dates in Days in Excel Using a Generic Formula
In this section, we’ll use a generic formula to calculate the date differences in days.
- Select the cell range E5:E10 >> type the following formula.
=D5-C5
Here, we’re just simply subtracting the end date from the starting date.
- Press CTRL + ENTER to AutoFill our formula.
Read More: Excel formula to find difference between two numbers
7. Use of TODAY Function to Find Difference Between Current and Another Date in Days
For the last method, we’re gonna use the TODAY function and subtract the initial date value from it to find our date difference. We’ve removed a column from our dataset.
- Select the cell range E5:E10 >> type the following formula.
=TODAY()-C5
Here, we’re just simply subtracting the end date from today’s date. Therefore, your value will not be the same when you open this file. Moreover, if you have a large dataset, you should avoid using this function, as it will slow down your computer.
- Finally, press CTRL + ENTER.
This will AutoFill our formula. Thus, we’ve shown you yet another formula to find the difference between two dates in days format in Excel.
Read More: How to Calculate Time Difference Between Two Dates in Minutes in Excel
How to Calculate Difference Between Two Dates in Years/Months/Weeks in Excel
You can also calculate the difference between two dates in years/months/weeks. Here, we’re going to use the DATEDIF function for this purpose. This function is not listed in Excel, hence, you have to write the whole formula manually.
Now, we will find the difference between two dates in years, months, and weeks in the E column, F column, and G column respectively.
- To find the years only, use the following formula in the E5 cell.
=DATEDIF(C5,D5,"y")
- For finding the total months, use the below formula in cell F5.
=DATEDIF(C5,D5,"m")
- To calculate the weeks, write the corresponding formula in cell G5.
=DATEDIF(C5,D5,"d")/7
Actually, in the inverted comma, the DATEDIF function takes the argument for showing output.
How to Calculate an Entire Period in Excel
Furthermore, you can calculate an entire period of two given dates.
- To do so, use the below formula.
=DATEDIF(C5,D5,"y") & " Years, " & DATEDIF(C5,D5,"ym") & " Months, " & DATEDIF(C5,D5,"md") & " Days"
Formula Breakdown
- DATEDIF(C5,D5,”y”) —> returns the difference between D5 and C5 dates in years.
- Output: 3.
- DATEDIF(C5,D5,”ym”)—> gives the number of months between D5 and C5 ignoring the years.
- Output: 0.
- DATEDIF(C5,D5,”md”)—> calculates the total days between D5 and C5 ignoring the months.
- Output: 9.
- Ampersand (&) sign will join 3 with Years, 0 with Months, and 9 with Days.
In this way, you can also calculate the age of a person. You just need to use the TODAY function as the ending date and you must insert the date of birth as the starting date. The rest of the formula will be the same.
Calculator for Counting the Days Between Two Dates in Excel
Here, we have attached a sheet named Calculator. With the help of this Excel sheet, you can calculate the difference between any two dates in days.
In that sheet, you need to insert the starting date in B5 and the ending date in cell B9. Then get the total days in the D7 cell.
Practice Section
We’ve added practice datasets for each method in the Excel file.
Conclusion
We’ve shown you 7 methods of how Excel calculates difference between two dates in days. However, If you face any difficulties, feel free to comment below for assistance. Thanks for reading, keep excelling! To learn more about Excel, you can visit our website, ExcelDemy.
Related Articles
- How to Calculate Difference Between Two Times in Excel (8 Methods)
- Calculate Time Difference in Minutes in Excel (3 Easy Methods)
- How to Calculate Time Difference in Excel VBA (2 Methods)
- Calculate Time Difference in Numbers (5 Easy Ways)
- How to Find Significant Difference Between Two Numbers in Excel
- Calculate Difference Between Two Rows in Pivot Table (with Easy Steps)