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.
Download Practice Workbook
Download this practice workbook to exercise while you are reading this article.
3 Handy Approaches to Calculate Time Difference in Minutes 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. Use Formula to Calculate Time Difference in Minutes in Excel
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.
- 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.
- Finally, press Enter to get the results in minutes.
- Use the AutoFill Tool to apply the same formula in the following cells.
- Excel formula to find difference between two numbers
- How to Calculate Significant Difference Between Two Means in Excel
- Excel Pivot Table: Difference between Two Columns (3 Cases)
2. Combine 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
- To find the difference in days, insert the formula with the DAYS function.
- 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.).
- 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
- 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
- Write the following formula with the HOUR function.
- 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. Run a VBA Code to Calculate Time Difference in Minutes in Excel
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 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.
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, the Exceldemy Team, are always responsive to your queries.
Stay with us and keep learning.