How to Calculate Time Difference in Minutes in Excel?

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


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

Get FREE Advanced Excel Exercises with Solutions!
Bhubon Costa
Bhubon Costa

Bhubon Costa, B.Sc. in Naval Architecture & Marine Engineering from Bangladesh University of Engineering & Technology, has worked with the ExcelDemy since 2021. Currently, he has been working as a reviewer. Notably, he has written over 90 articles and led several VBA content development teams. He has a great passion for the fields of data analytics and data science. His areas of expertise include Excel VBA, Power Query, Pivot Table, Power BI, MySQL, PostgreSQL, machine learning, and Python... Read Full Bio

We will be happy to hear your thoughts

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo