How to Calculate Difference Between Two Dates and Times in Excel

If you want to find out the difference between two dates or times in Excel, you will find this article useful. Here you can find how to calculate the difference between two dates and times in numerous formats in Excel.


1. Calculating the Difference Between Two Dates in Excel

Suppose you want to know the times taken to complete different projects of your company. For that, you need to find the difference between the project’s starting date and the project’s ending date. Let’s say in your dataset, you have the Starting Date of different projects in column C and the Ending Date in column D.

Sample Dataset to Calculate Time Difference Between Two Dates in Excel

You can use Excel functions to find out the difference between two dates in days, weeks, months, and years. Remember, the difference must be calculated in Number format.


1.1 Difference Between Two Dates in Days

To find out the difference between two dates in days, we can use the DAYS function. To accomplish this, follow the steps below.

📌 Steps:

  • First, click on cell E5.
  • Subsequently, insert the following formula and hit the Enter key.
=DAYS(D5,C5)

DAYS function to Calculate Time Difference Between Two Dates in Excel

  • You can also find out the difference in days by subtracting the two cells.

Subtraction Feature Calculate Time Difference Between Two Dates in Excel


1.2 Difference Between Two Dates in Weeks

To find out the difference between two dates in weeks, follow the steps below.

📌 Steps:

  • At the very beginning, click on cell E6 and insert the following formula.
=DAYS(D6,C6)/7
  • Subsequently, press the Enter key.

Formula to Calculate Time Difference Between Two Dates in Weeks in Excel

  • You can also find out the difference in weeks by subtracting the two cells and dividing by 7.


1.3 Difference Between Two Dates in Months

To find out the difference between two dates in months, go through the steps below.

📌 Steps:

  • Initially, click on cell E7 and insert the formula below.
=DAYS(D7,C7)/30
  • Following, hit the Enter key.

Formula to Calculate Time Difference Between Two Dates in Months in Excel

  • You can also find out the difference in months by subtracting the two cells and dividing by 30.

Subtraction Feature to Calculate Time Difference Between Two Dates in Months in Excel


1.4 Difference Between Two Dates in Years

To find out the difference between two dates in years, follow the steps below.

📌 Steps:

  • First and foremost, click on your desired cell (cell E8 here).
  • Afterward, insert the formula below and hit the Enter key.
=DAYS(D8,C8)/365

Formula to Calculate Time Difference Between Two Dates in Years in Excel

  • You can also find out the difference in years by subtracting the two cells and dividing by 365.

Subtract to Find Year Difference Between Two Dates

Read More: Excel Calculate Hours Between Two Times After Midnight


2. Calculating the Difference Between Two Times in Excel

Now, suppose you want to find out the times your employees are working. For that, you need to know the difference between the entry time and exit time of an employee. In your dataset, you have the Entry Time of different employees in column C and the Exit Time in column D.

Sample Dataset to Calculate Time Difference Between Two Times in Excel

Remember the difference must be calculated in Number format.


2.1 Difference Between Two Times in Hours

Now, to find out the difference between two times in hours, follow the steps below.

📌 Steps:

  • First, click on cell E5 and insert the following formula.
=(D5-C5)*24
  • Subsequently, press the Enter key.

Formula to Calculate Time Difference Between Two Times in Hours in Excel


2.2 Difference Between Two Times in Minutes

To find out the difference between the two times in minutes, go through the steps below.

📌 Steps:

  • Initially, click on cell E6 and write the following formula in the formula bar.
=(D6-C6)*1440
  • Subsequently, hit the Enter key.

Formula to Calculate Time Difference Between Two Times in Minutes in Excel


2.3 Difference Between Two Times in Seconds

At this time, to find out the difference between the two times in seconds, follow the steps below.

📌 Steps:

  • Initially, click on your desired cell (cell E7 here).
  • Following, insert the formula below and hit the Enter key.
=(D7-C7)*86400

Formula to Calculate Time Difference Between Two Times in Seconds in Excel

Read More: Calculate Elapsed Time Between Two Dates in Excel


3. Determining the Difference in Each Time Unit in Excel

Suppose you want to know the difference between hours, minutes, or seconds of two times, you also can do that using Excel. Now we will determine the Hours unit, Minutes unit, and Second unit difference of Exit and Entry times of different employees.

Sample Dataset to Calculate Time Difference Between Two Dates and Times in Excel

  • To find the difference in hour units, we can use the HOUR function.
  • To do this, in cell E5, type the formula below and press the Enter key.
=HOUR(D5-C5)

Formula to Calculate Time Difference Between Two Dates and Times in Hours in Excel

  • Moreover, to find the difference in minute units we can use the MINUTE function.
  • In order to do this, in cell F5, type the formula below and hit the Enter key.
=MINUTE(D5-C5)

Formula to Calculate Time Difference Between Two Dates and Times in Minutes in Excel

  • Furthermore, to find the difference in the second unit, we can use the SECOND function.
  • To do this, In cell G5, insert the following formula and press the Enter key.
=SECOND(D5-C5)

Formula to Calculate Time Difference Between Two Dates and Times in Seconds in Excel


4. Calculating the Difference Between Two Dates and Times Simultaneously

If Date and Time are given as a single entry, we can find the date and time together. Consider the following Dataset. Here, Starting and Ending date and time of each project are given.

Sample Dataset to Calculate Time Difference Between Two Dates and Times in Excel

Go through the steps below to calculate the difference between two dates and times in Excel simultaneously.

📌 Steps:

  • First, click on cell E5.
  • Following, insert the formula below.
=INT(D5-C5) & " Days, " & HOUR(D5-C5) & " Hours, " & MINUTE(D5-C5) & " Minutes, " & SECOND(D5-C5) & " Seconds "
  • Subsequently, hit the Enter key.

Formula to Calculate Time Difference Between Two Dates and Times in Excel

  • Afterward, use the fill handle feature to copy the same formula below and get the result for that data as well.

Read More: How to Calculate Time Difference Between AM and PM in Excel


5. Finding the Time Difference From a Start Time to Now

Time difference between the past and present can also be determined by Excel. Suppose your employees have started working some hours ago. Now you want to find out how much time they have worked so far. To find that we will use the NOW function. Follow the steps below to accomplish this.

Sample Dataset to Calculate Elapsed Time

📌 Steps:

  • At the very beginning, click on cell D5 and insert the formula below.
=NOW()-C5
  • Subsequently, hit the Enter key.

Formula to Calculate Elapsed Time

  • Afterward, use the fill handle feature to copy the same formula for all the cells below to get the same result for the other data.

Read More: How to Calculate Hours Between Two Times in Excel


6. Calculating Negative Times in Excel

You can also calculate negative time in Excel but you need to change a default setting first to do this. Follow the steps below to accomplish this.

📌 Steps:

  • First and foremost, go to the File tab.

Access File Tab

  • Following, click on the Options option from the expanded File tab.

Choose Options Option

  • As a result, the Excel Options window will appear.
  • Now, go to the Advanced tab here and tick on the option Use 1904 date system.
  • Subsequently, click on the OK button.

Excel Options Window

  • Thus, you can calculate negative time in Excel. For example, we will subtract 12:50 PM from 9:30 AM in cell D5.

Calculated Negative Time


Download Practice Workbook

You can download our practice workbook from here for free!


Conclusion

So, finding the difference between two dates and times in Excel is not so hard. I hope, after going through this article, now you can easily find the difference. If you have any confusion please leave a comment, so I will be able to help you.


Related Articles


<< Go Back to Calculate Time Difference | Calculate Time | Date-Time in Excel | Learn Excel

Get FREE Advanced Excel Exercises with Solutions!
Prantick Bala
Prantick Bala

PRANTICK BALA is a marine engineer who loves exploring Excel and VBA programming. Programming, to him, is a time-saving tool for efficiently managing data, files, and internet tasks. He is proficient in Rhino3D, Maxsurf, C++, MS Office, AutoCAD, Excel, and VBA and goes beyond the basics. Armed with a B.Sc in Naval Architecture & Marine Engineering from BUET, he has transitioned into the role of a content developer. Beyond his work, find him immersed in books, exploring new... Read Full Bio

We will be happy to hear your thoughts

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo