If you work with data where you have time values then the tips which I’m going to share today can be helpful for you.

Now listen.

In Excel, there’s a lot of functions to deal with date and time.

But there is no specific function which you can use to get the difference between times values.

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.

=(end_time-start_time)*24

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.

=INT((end_time-start_time)*24)

#### 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.

=(end_time-start_time)*1440

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.

=(end_time-start_time)*86400

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.

But…But…But…

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.

## Sample File

Download this sample file from here to learn more.

## Conclusion

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.

Do you know how to calculate the difference in a given start date and end date when you want to exempt weekends and certain holidays except not by using the NETWORKDAYS function?

Hi, I have a problem with calculating 2 times. Let´s say I ride my bike a total och 35h35m35s and the goal is 40h0m0s. To calculate the difference both negative and positive does´nt seem to work.

I tried the =TEXT(C42-C43,”hh:mm:ss”) where C42 is the total and C43 the set goal.

Excel does not recognize this as a formula at all and says it´s a problem with this formula?

I tried to search the net for a solution but did´nt find any.

PS. The format of the cell is the 37:30:55.

Regards!

Mika

Hello,

what if i need to calculate daily working hours (8) hrs if exceed 8 hrs to calculat the over time for the three shifts and the timing concidering timing from 19:00 to 07:00 as 1.5 rate and other hours will be in 1.25 rate

means

Example

Exmp1-08:00 to 20:00 8 hrs duty 4 hrs Over time ( 3hrs @1.25 & 1hr @1.5)

Exmp2-20:00 to 05:00 8 hrs duty 1 hr Over time (@1.5) (till 07:00 the rate will be 1.5)after 07:00 rate will be 1.25

Please advise

4/15/2021 14:44 4/17/2021 13:35 22:51

I am trying to calculate a time over the span of more than 2 days but it is giving results for less than one day

THNK YOU!! I have been scouring the net trying to find out how to calculate two times as a number In Excel!!! You’re a lifesaver!

Looking to use a 4 digit number as time (don’t want to input the colon) so times look like”

1347 2152 (start and end time)

What formats would you use as defined in each cell? General, Number or time (nn:nn)?

What formula would you use?

I would like to see the three cells like this:

nnnn nnnn nn:nn

Thanks.

Hello, how can I quickly calculate the time from a report that provideS the starting and ending time like this. To make sure you understand, the first line is 6.32.59 am to 6.50.24am

Start End

63259 65024

65024 84435

84435 90048

90048 102856

102856 104047

104047 111507

111507 113000

123449 132758

132758 135942

135942 141500

141500 144414

144414 145926

Hi Puneet,

Can you please help me with the formula needed to calculate the time difference in my example below? I keep getting the incorrect amount when the start and end time crosses days.

Start 09/20/2020 07:01:28 PM End 09/21/2020 08:12:36 AM

Within this time period, I also need to determine the hours worked between 7:00 pm – 7:00 am.

Thanks

Hi Puneet,

I have a slightly different problem and am hoping you can answer.

In my sheet as follows

Column C4= Start Date

Column D4= Start Time

Column E4 = Total break in imutes

Column F4= End Date

Column G4= End Time

and finally

Column H4= Total hours Work

I have tried different combinations from various websites, but am unable to find a solution for column H4.

Appreciate your help.

Thanks

How would I display time difference in hours and minutes instead of hours in whole numbers and decimals representing units of 100 instead of 60?

Eg: for 4 and half hours I want it to show 4.30 and not 4.5? I know the complex method is to convert it painstakingly and it is both lengthy and not the right way. Wanted to know if you have deduced a simpler and appropriate method. Thanks!

You are a life saver!!! Thanks! Keep up the good work!

Sir, 20th Feb, 2020

How could you do this ? Miracle !

I can’t believe.

Many, many efforts you might have taken. Isn’t it ?

Lot of thanks.

Interested in Excel, person like me , will very happy to note such Tips and Tricks.

I will be glad to receive more and notes from you in future too.

Once again thanks.

Kanhaiyalal Newaskar.

Hello,

How do I create a Nested IF function to calculate pieces picked between two times? Example: I have 42 cases picked between 8:30 am and 9:15 am. I need a formula to capture what was picked in each time period and have each quantity placed under the correct hour (ex: 8:00 am – 9:00 am and 9:00 am – 10:00 am). Is there a function that will allow me to do this? If so, please help.

Start Dates Trips END DATE Trips per day DAYS LEFT

22-06-2019 362 23-07-2019 9 8

22-06-2019 99 23-07-2019 10 8

05-07-2019 76 06-08-2019 12 26

23-06-2019 192 24-07-2019 14 7

I tried multiple formulas but as you see start date is 22 june and end date is 23 july the days left should show 1 day left is shows 8 can you help

Hi Puneet

How do we get a difference between a combination of date & time and date & time without using text to columns for separate date & time.

For this example :04/04/2019 06:00am – 05/04/2019 07:00pm

Thanks for this!

How could I modify the formula to check on the date?

for example, I started at 5 am yesterday, and and ended at 9 am today, the formula would just give 4 hours (if I multiply by 24) instead of 16 hours.

How do you calculate time difference when it’s negative, without getting the ####### treatment?

Reason I’ve needed this is for a work timesheet. If I work later than I should then I’ve worked longer & hence the difference will be positive (time worked in advance of being paid). I then keep a running total of this time.

But another day, when I leave early because I have excess time to “use up”, the difference is negative and ##### results, along with the running total becoming #######.

Potentially, the daily difference AND the running total could be negative so both need to display a negative value without the ### issue happening.

Only way I’ve found is to convert it to decimal number (as in your #2 example, but doing it into mins, then after that dividing that result by 60 to get back to hours as decimal). Problem is then it shows time as -1.25 for example.

How then can one convert the time difference to show as -1:15, as well as still be used as a number to keep the running total going?

How do I calculate time difference between two days i.e. 3/31/19 23:30 start time, and 4/1/19 02:30 end time? The result I want is 3.0 hrs?

DATE DAY IN TIME OUT TIME TOTAL

26-12-2018 Wednesday 11:30 7:45 PM 8:15

27-12-2018 Thursday 10:55 7:30 PM 8:35

28-12-2018 Friday 11:00 7:00 PM 8:00

29-12-2018 Saturday 10:45 6:21 PM 7:36

how can i calculate the total hours of four days, Each day wise i applied formula, kindly send the formula if any one knows

thanks for sharing knowledge.

You can also use datediff to get the time difference

I need to calculate Time with two different dates, Like TAT calculation