As you know, a time value is a numeric value which is formatted as time but when you deduct one value from another it returns a decimal number and you need format it again as time.
But here comes the pain:
When you format that result value it shows that values as hours and minutes (starting from 00:00) instead of showing actual difference in hours and minutes.
So if you have a difference of 5 hours and 30 minutes it will show it as 05:00 AM.
You don’t have to worry anymore.
6 Ways to Calculate Time Difference Between Two Times in Excel
Here are the 6 different methods which you can use to get the difference between time values which you can use as per your need.
…let’s get started.
1. Get Difference in Hours and Minutes
This is one the most common way to get the difference between two times.
Let’s suppose you have a start and end time (like below) where you need to get the difference of both.
- First of all, you can simply deduct the end time from the start time and you’ll get something like below.
- Now next you need to convert this time into hours and minutes.
- For this, select the cell and open format options (Ctrl + 1).
- After that, select the “Time” category and select the second time format.
- In the end, click OK.
Once you do this it will convert (Format) that time difference into hours and minutes instead of normal time format.
2. Get Different in Hours in Numbers
This is not a common way to get time difference but still useful and important.
Let’s say you want to get the difference between start and end time in hours but not in normal numbers.
For example, if the difference between start and end time is 4 hours and 30 minutes it should show it as 4.5 hours.
Here’s the formula which you need to use.
Once you enter this formula it returns the hours in numbers and minutes (if you have) in decimals.
How this formula works
As I said before, Excel stores date and time in numbers and when you deduct end time from the start time it returns a decimal.
And when further you multiply it by 24 (total number of hours in a day) it converts that decimals into the number of hours and minutes.
3. Get Different in Completed Hours
You can also calculate the completed hours between two times with this simple formula.
How this formula works
This formula is just like the formula which we have used in the second method, the only difference is here we have wrapped it in INT.
INT function returns the integer part decimal by rounding it down. You can learn more about it from here.
So when you enter this formula, first of all, it returns a decimal number for the hours and then INT removes the fractional part and gives you completed hours.
4. Get Difference in Minutes
It happens sometimes that you need to track time difference in minutes instead of hours, and in this case, the best way is to use the below formula.
In this formula, after deducting start time from end time we have multiplied it by 1440 which is the total number of minutes we have in 24 hours.
And when you enter this formula you’ll get the difference between two values in minutes.
Quick Tip: If somehow you have seconds in your time values then you use below formula to get the total complete minutes between start and end time.
#5. Get Difference in Seconds
Same like minutes we can also get the difference in seconds. All you need to do is to use the following formula.
Here 86400 is the total second in 24 hours and when you enter this formula it will return the difference in start and end time in seconds.
6. Calculate Difference as a Negative Value
In all the above example, we have the end time which is greater than (later than) the start time.
Let’s suppose you have two time values where the end time is earlier than the start time.
In simple words, if the start time is 11:00 PM on day 1, and the end time is 5:00 AM day 2.
The end time is actually less than the start time and the simple subtract formula will not work and return a negative value which will cause Excel to display a string of hash characters (i.e. ########).
Don’t worry you can use a better formula for this.
So the formula will be:
=IF(end>start, end-start, 1-start+end)
How this formula works
In this formula, you have a condition if the end time is greater than the start time then it will simply deduct end time from the start time otherwise, firstly it will deduct start time from 1 and then add it into the end time.
By subtracting the start time from 1, you will get the total time for the day 1 and when you add it to the end time, you’ll get the total time of day 1 and day 2 which is the total difference.
For Excel users who deal with time data, it’s really important to know various methods to get the difference between two times.
And all the methods which we have used above can be used in different situations and I’m sure you have found all of these helpful.
But you need to tell me one thing.
Do you know any other method which you can use to get the difference between the start time and end time?
Share your views with me in the comment section, I’d love to hear from you and make sure to share this tip with your friends.
About the Author
Puneet is using Excel since his college days. He helped thousands of people to understand the power of the spreadsheets and learn Microsoft Excel. You can ﬁnd him online, tweeting about Excel, on a running track, or sometimes hiking up a mountain.