Excel Calculates Difference Between Two Dates in Days: 7 Ways

Method 1 – Using DATEDIF Function to Find Difference Between Two Dates in Days

Use the DATEDIF function to calculate the difference between two dates. This function is not listed in Excel, no tooltip will be displayed for this function. We’ve added a column Total Days in our dataset.

Using DATEDIF Function to Find Difference Between Two Dates in Days

  • 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.

Use of Fill Handle icon to autofill the formula

Get the total days of all cells

Here you will see all the total days.


Calculating Days Ignoring Years from Dates

We used the following formula in cell E5.

=DATEDIF(C5,D5,"Yd")

Our initial date is in cell C5, and the end date is in cell D5. We’re setting our output format to days using Yd in the function. The years will not be considered here, which means days are counted from 01 March to 10 March.

Calculating Days Ignoring Years from Dates

We have used the same formula for the rest of the cells.


Method 2 – Use of DAYS Function to Find Date Difference in Days

  • Type the following formula in cell E5.
=DAYS(D5,C5)

The syntax of this function is DAYS(end_date,start_date). Our end date is on cell D5 and the initial date is on cell C5.

Use of DAYS Function to Find Date Difference in Days

  • Press ENTER and AutoFill the formula.

We can see this is the simpler version of the DATEDIF function.


Method 3 – Calculating Difference Between Two Dates in Days Using DAYS360 Function

  • Type the following formula in cell E5.
=DAYS360(C5,D5)

The syntax of this function is DAYS360(start_date,end_date). Our initial date is on cell C5 and the end date is on cell D5.

Difference Between Two Dates in Days Using DAYS360 Function

  • Press ENTER to get the result.
  • AutoFill the formula for the rest of the cells.
Note: This function assumes that every month consists of 30 days. We’ll see some differences in the output from methods 1 and 2.

Method 4 – Using DATE Function to Find Days Between Two Dates

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))

Using DATE Function to Find Days Between Two Dates

Formula Breakdown

Our formula has two DATE functions. 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 Serial Number format.
  • Our second portion will return 44621.
  • We’re subtracting it to get our date difference (44691-44621=70).
  • AutoFill the formula for the rest of the cells.

We found the difference between the two dates in day format.


Method 5 – Calculate Workdays Between Two Dates in Days in Excel

There are two functions in Excel. One is the NETWORKDAYS function. And the other is the NETWORKDAYS.INTL function.

5.1 Use of NETWORKDAYS Function to Count Workdays

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.

Use of NETWORKDAYS Function to Count Workdays

  • 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]). Our initial date is on cell C5, and the end date is on cell D5 and our holidays are in the range C13:C14. Moreover, remember to use absolute cell references in this function.

  • Press ENTER.

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.

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. Select any of them. Additionally, you have to create a holiday list.

Weekends list in NETWORKDAYS.INTL Function

The final formula is given below.

=NETWORKDAYS.INTL(C5,D5,1,$C$13:$C$26)
  • Press ENTER to get the result >> Use the Fill Handle icon for the other cells.

Use of NETWORKDAYS.INTL Function for Counting Workdays


Method 6 – Find the 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 range E5:E10 >> type the following formula.
=D5-C5

We’re subtracting the end date from the starting date.

  • Press CTRL + ENTER to AutoFill our formula.

Find Difference Between Two Dates in Days in Excel Using a Generic Formula


Method 7 – Use of TODAY Function to Find Difference Between Current and Another Date in Days

Use the TODAY function and subtract the initial date value to find our date difference. We’ve removed a column from our dataset.

  • Select the range E5:E10 >> Type the following formula.
=TODAY()-C5

Use of TODAY Function to Find Total Days

We’re subtracting the end date from today’s date. Therefore, your value will not be the same when you open this file. If you have a large dataset, you should avoid using this function, as it will slow down your computer.

  • Press CTRL + ENTER.

How to Calculate the Difference Between Two Dates in Years/Months/Weeks in Excel

You can also calculate the difference between two dates in years/months/weeks. We’re going to use the DATEDIF function for this purpose. This function is not listed in Excel. You have to write the whole formula manually.

Find the difference between two dates in years, months, and weeks in columns E, F, and G.

Calculate Difference Between Two Dates in Years/Months/Weeks in Excel

  • Use the following formula in cell E5.
=DATEDIF(C5,D5,"y")
  • To find 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

In the inverted comma, the DATEDIF function takes the argument for showing output.


How to Calculate an Entire Period in Excel

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"

How to Calculate an Entire Period in Excel

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.

You can also calculate the age of a person. 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

We attached a sheet named Calculator. With the help of this Excel sheet, you can calculate the difference between any two dates in days.

You need to insert the starting date in cell B5 and the ending date in cell B9. Then get the total days in cell D7.

Calculator for Counting the Days


Download Practice Workbook

Download the following practice workbook. It will help you to realize the topic more clearly.


Related Articles


<< Go Back to Days Between Dates | Date-Time in Excel | Learn Excel

Get FREE Advanced Excel Exercises with Solutions!
Rafiul Haq
Rafiul Haq

Rafiul Haq worked as an Excel and VBA Content Developer in Exceldemy for over two years and published almost 200 articles for the website. He is passionate about exploring new aspects of Excel and VBA. He received his Bachelor of Science in Mechanical and Production Engineering (MPE) from the Islamic University of Technology. Rafiul furthered his education by obtaining an MBA in Finance from the Institute of Business Administration (IBA) at the University of Dhaka. Apart from creating... Read Full Bio

We will be happy to hear your thoughts

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo