How to Calculate Time Difference in Minutes in Excel?

Get FREE Advanced Excel Exercises with Solutions!

While working with a time-dependent data set, you often need to calculate the time difference in minutes. Excel has no dedicated function to calculate the time difference in minutes for different dates. So, in this tutorial, we will show you how to calculate the time difference in minutes for different dates in Excel.

The following image provides a data set containing some entries with an end time and a start time. Firstly, we will use a general formula to calculate the time difference in minutes. Later on, we will apply some functions such as DAYS, HOUR, MINUTE, and SECOND to do the same. Additionally, we will use the VBA code to calculate the time difference in minutes.

Sample Data


1. Using Excel Formula to Calculate Time Difference in Minutes

In the beginning, we will use a general Excel formula to subtract the Start Time from the End Time.

Step 1: Find the Time Difference in Dates

  • To find the difference in dates, type the following formula.
= (C5-B5)

Handy Approaches to Calculate Time Difference in Minutes in Excel

  • Therefore, it will calculate the days’ difference between the two dates. It will show the result in the decimal units.

Handy Approaches to Calculate Time Difference in Minutes in Excel

Step 2: Use a Formula to Calculate the Time Difference

  • Type the following formula to convert the day number into minutes.
=(C5-B5)*24*60

Handy Approaches to Calculate Time Difference in Minutes in Excel

  • Finally, press Enter to get the results in minutes.

Handy Approaches to Calculate Time Difference in Minutes in Excel

  • Use the AutoFill Tool to apply the same formula in the following cells.

Handy Approaches to Calculate Time Difference in Minutes in Excel

Read More: How to Subtract Date and Time in Excel


2. Combining DAYS, HOUR, and SECOND Functions to Calculate Time Difference

Excel doesn’t have a dedicated function to calculate just the time difference in minutes for two different dates. But we can separately calculate the difference in the number of days, hours, minutes, and seconds. Then, we will apply a formula to combine the results and count the time difference in minutes.

Step 1: Find the Difference in Days

=DAYS(C5,B5)

Handy Approaches to Calculate Time Difference in Minutes in Excel

  • Therefore, it will show ### as there is no specific format defined.

Handy Approaches to Calculate Time Difference in Minutes in Excel

  • Click on the Number format to specify the cell value.

Handy Approaches to Calculate Time Difference in Minutes in Excel

  • As a result, it will result in the number of days for two different dates.

Handy Approaches to Calculate Time Difference in Minutes in Excel

  • Then, use the AutoFill Tool to auto-fill the cells.

Handy Approaches to Calculate Time Difference in Minutes in Excel

Step 2: Count the  Time Difference in Minutes

  • Type the following formula with the MINUTE function to calculate the minute difference for a particular day (10:30 A.M. to 10:53 A.M.).
=MINUTE(C5-B5)

Handy Approaches to Calculate Time Difference in Minutes in Excel

  • Therefore, it will show the minute difference (23 minutes) in cell E5.

Handy Approaches to Calculate Time Difference in Minutes in Excel

  • Simply, auto-fill the column by using the AutoFill Tool.

Handy Approaches to Calculate Time Difference in Minutes in Excel

Step 3: Apply the SECOND Function

  • For counting the time difference in seconds, write the following formula with the SECOND function.
=SECOND(C5-B5)

Handy Approaches to Calculate Time Difference in Minutes in Excel

  • As a consequence, you will find the time difference in seconds.

Handy Approaches to Calculate Time Difference in Minutes in Excel

  • Finally, auto-fill the cell with the help of the AutoFill Tool.

Handy Approaches to Calculate Time Difference in Minutes in Excel

Step 4: Insert the HOUR Function

=HOUR(C5-B5)

Handy Approaches to Calculate Time Difference in Minutes in Excel

  • Consequently, cell E5 will result in a time difference in hours.

Handy Approaches to Calculate Time Difference in Minutes in Excel

  • Finally, auto-fill all the cells by applying the AutoFill Handle Tool.

Handy Approaches to Calculate Time Difference in Minutes in Excel

Step 5: Apply the Final Formula

  • To combine all the results using the functions, type the following to calculate the time difference in minutes.
=D5*24*60 +E5*60 + F5 + G5/60

Handy Approaches to Calculate Time Difference in Minutes in Excel

  • Therefore, you will obtain the result of the time difference in minutes as in the image shown below.

Sample Data

  • Finally, apply the AutoFill Tool to fill in all the cells in the column.

Sample Data

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


3. Running VBA Macro to Calculate Time Difference in Minutes

In addition to the previous sections, we will show you how to use VBA code to calculate the time difference in minutes. The benefit of using the VBA code is that we can choose any of two cells with different times and dates, and calculate the time difference in minutes.

Step 1: Create a Module

  • Firstly, press  Alt  +  F11  to open the VBA Macro.
  • Click on the Insert tab.
  • Then, select the Module option to create a new module.

Sample Data

Step 2: Paste the VBA code

  • Paste the following VBA code.
Sub TimeDifference()
'Define variables
    Dim MinDifference As Variant
    Dim StartTime As Variant
    Dim EndTime As Variant
'Insert Input box to select start time
Set StartTime = Application.InputBox("Select Start Time:", "ExcelDemy", RngText, , , , , 8)
'Insert Input box to select start time
Set EndTime = Application.InputBox("Select End Time:", "ExcelDemy", RngText, , , , , 8)
'Subtract times
MinDifference = EndTime - StartTime
'Apply formula in a cell to get the result in minutes
Range("E5").Value = MinDifference * 24 * 60
End Sub

Sample Data

Step 3: Run the Program

  • Save the program and press  F5  to run it.
  • Select the start time.
  • Press Enter.

Sample Data

  • Select the end time.
  • Then, click on OK.

Sample Data

  • Therefore, your time difference will show the result in minutes in cell E5.

Sample Data

Read More: How to Subtract Minutes from Time in Excel


Download Practice Workbook

Download this practice workbook to exercise while you are reading this article.


Conclusion

I hope this article has given you a tutorial about how to calculate the time difference in minutes in Excel. All of these procedures should be learned and applied to your dataset. Take a look at the practice workbook and put these skills to the test. We’re motivated to keep making tutorials like this because of your valuable support.

Please contact us if you have any questions. Also, feel free to leave comments in the section below.

We are always responsive to your queries.

Stay with us and keep learning.


Related Articles

What is ExcelDemy?

ExcelDemy Learn Excel & Excel Solutions Center provides free Excel tutorials, free support , online Excel training and Excel consultancy services for Excel professionals and businesses. Feel free to contact us with your Excel problems.
Bhubon Costa
Bhubon Costa

Myself, Bhubon Costa, an engineer, is currently employed with Exceldemy as an Excel & VBA Content Developer. I appreciate solving analytical difficulties, finding practical answers, and, for the most part, I enjoy taking on new tasks. I write articles on Exceldemy about various ways to get out of Microsoft Excel's stuck conditions. My passion is to leave my mark on the world through my work and to have an impact on the community who benefit from it.

We will be happy to hear your thoughts

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo