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.

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

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

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`

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

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

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

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

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

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

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

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

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

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

Step 3: Apply the SECOND Function

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

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

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

Step 4: Insert the HOUR Function

`=HOUR(C5-B5)`

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

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

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`

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

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

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.

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

Step 3: Run the Program

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

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

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

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.

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

Advanced Excel Exercises with Solutions PDF