*This tutorial focuses on various ways to calculate times in Excel. You will find a few useful formulas to add and subtract times, calculate time difference, or elapsed time, and more. *

In the last week's article, we had a close look at the specificities of Excel time format and capabilities of basic time functions. Today, we are going to dive deeper into Excel time calculations and you will learn a few more formulas to efficiently manipulate times in your worksheets.

To begin with, let's see how you can quickly calculate elapsed time in Excel, i.e. find the difference between a beginning time and an ending time. And as is often the case, there is more than one formula to perform time calculations. Which one to choose depends on your dataset and exactly what result you are trying to achieve. So, let's run through all methods, one at a time.

As you probably know, times in Excel are usual decimal numbers formatted to look like times. And because they are numbers, you can add and subtract times just as any other numerical values.

The simplest and most obvious Excel formula to calculate time difference is this:

=*End time* - *Start time*

Depending on you data structure, the actual time difference formula may take various shapes, for example:

Formula |
Explanation |

`=A2-B2` |
Calculates the difference between the time values in cells A2 and B2. |

`=TIMEVALUE("8:30 PM") - TIMEVALUE("6:40 AM")` |
Calculates the difference between the specified times. |

`=TIME(HOUR(A2), MINUTE(A2), SECOND(A2)) - TIME(HOUR(B2), MINUTE(B2), SECOND(B2))` |
Calculates the time difference between values in cells A2 and B2 ignoring the date difference, when the cells contain both the date and time values. |

Remembering that in the internal Excel system, times are represented by fractional parts of decimal numbers, you are likely to get the results similar to this:

The decimals in column D are perfectly true but not very meaningful. To make them more informative, you can apply custom time formatting with one of the following codes:

Time code |
Explanation |

h | Elapsed hours, display as 4. |

h:mm | Elapsed hours and minutes, display as 4:10. |

h:mm:ss | Elapsed hours, minutes and seconds, display as 4:10:20. |

To apply the custom time format, click Ctrl + 1 to open the *Format Cells* dialog, select *Custom* from the *Category list* and type the time codes in the *Type* box. Please see Creating a custom time format in Excel for the detailed steps.

And now, let's see how our time difference formula and time codes work in real worksheets. With *Start times* residing in column A and *End times* in column B, you can copy the following formula in columns C though E:

`=$B2-$A2`

The elapsed time is displayed differently depending on the time format applied to the column:

Another simple technique to calculate the duration between two times in Excel is using the TEXT function:

- Calculate
**hours**between two times:`=TEXT(B2-A2, "h")`

- Return
**hours**and**minutes**between 2 times:`=TEXT(B2-A2, "h:mm")`

- Return
**hours**,**minutes**and**seconds**between 2 times:`=TEXT(B2-A2, "h:mm:ss")`

- The value returned by the TEXT function is always text. Please notice the left alignment of text values in columns C:E in the screenshot above. In certain scenarios, this might be a significant limitation because you won't be able to use the returned "text times" in other calculations.
- If the result is a negative number, the TEXT formula returns the #VALUE! error.

To get the time difference in a single time unit (hours ,minutes or seconds), you can perform the following calculations.

**Calculate hours between two times**:

To present the difference between two times as a **decimal number**, use this formula:

=(*End time* - *Start time*) * 24

Supposing that your start time is in A2 and end time in B2, you can use a simple equation B2-A2 to calculate the difference between two times, and then multiply it by 24, which is the number of hours in one day:

`=(B2-A2) * 24`

To get the number of **complete hours**, use the INT function to round the result down to the nearest integer:

`=INT((B2-A2) * 24)`

**Total minutes between two times**:

To calculate the minutes between two times, multiply the time difference by 1440, which is the number of minutes in one day (24 hours * 60 minutes = 1440).

=(*End time* - *Start time*) * 1440

As demonstrated in the following screenshot, the formula can return both positive and negative values, the latter occur when the end time is less than the start time, like in row 5:

`=(B2-A2)*1440`

**Total seconds between times**:

To get the total seconds between two times, you multiply the time difference by 86400, which is the number of seconds in one day (24 hours * 60 minutes * 60 seconds = 86400).

=(*End time* - *Start time*) * 86400

In our example, the formula is as follows:

`=(B2-A2)* 86400`

To find the difference between 2 times in a certain time unit, ignoring the others, use one of the following functions.

- Difference in
**hours**, ignoring minutes and seconds:`=HOUR(B2-A2)`

- Difference in
**minutes**, ignoring hours and seconds:`=MINUTE(B2-A2)`

- Difference in
**seconds**, ignoring hours and minutes:`=SECOND(B2-A2)`

When using Excel's HOUR, MINUTE and SECOND functions, please remember that the result cannot exceed 24 for hours and 60 for minutes and seconds.

In order to calculate how much time has elapsed since the start time to now, you simply use the NOW function to return today's date and the current time, and then subtract the start date and time from it.

Supposing that the beginning date and time is in call A2, the formula `=NOW()-A2`

returns the following results, provided you've applied an appropriate time format to column B, *h:mm* in this example:

In case the **elapsed time** **exceeds 24 hours**, use one of these time formats, for example *d "days" h:mm:ss* like in the following screenshot:

If your starting points contain only time values without dates, you need to use the TIME function to calculate the elapsed time correctly. For example, the following formula returns the time elapsed since the time value in cell A2 up to now:

`=TIME(HOUR(NOW()), MINUTE(NOW()), SECOND(NOW())) - A2`

This is probably the most user-friendly formula to calculate time difference in Excel. You use the HOUR, MINUTE and SECOND functions to return corresponding time units and the INT function to compute the difference in days. And then, you concatenate all these functions in a single formula along with the text labels:

`=INT(B2-A2) & " days, " & HOUR(B2-A2) & " hours, " & MINUTE(B2-A2) & " minutes and " & SECOND(B2-A2) & " seconds"`

To instruct your Excel time difference formula to hide zero values, embed four IF functions into it:

`=IF(INT(B2-A2)>0, INT(B2-A2) & " days, ","") & IF(HOUR(B2-A2)>0, HOUR(B2-A2) & " hours, ","") & IF(MINUTE(B2-A2)>0, MINUTE(B2-A2) & " minutes and ","") & IF(SECOND(B2-A2)>0, SECOND(B2-A2) & " seconds","")`

The syntax may seem excessively complicated, but it works :)

Alternatively, you can calculate time difference by simply subtracting the start time from the end time (e.g. `=B2-A2`

), and then apply the following time format to the cell:

*d "days," h "hours," m "minutes and" s "seconds" *

An advantage of this approach is that your result would be a normal time value that you could use in other time calculations, while the result of the complex formula discussed above is a text value. A drawback is that the custom time format cannot distinguish between zero and non-zero values and ignore the latter. To display the result in other formats, please see Custom formats for time intervals over 24 hours.

When calculating the time difference in Excel, you may sometimes get the result as ###### error because the difference is a negative time. But is there a way to show negative times properly in Excel? Of course, there is a way, and even more than one :)

The fastest and easiest way to display negative time normally (with a minus sign) is switching to the 1904 date system. To do this, click *File > Options > Advanced*, scroll down to the *When calculating this workbook section* and put a tick in the **Use 1904 date system** box.

Click *OK* to save the new settings, and from now on negative times will be displayed correctly, like negative numbers:

Is changing Excel's default Date System is not an option, then you can force negative times to display properly using one of the following formulas:

`=IF(A2-B2>0, A2-B2, "-" & TEXT(ABS(A2-B2),"h:mm"))`

`=IF(A2-B2>0, A2-B2, TEXT(ABS(A2-B2),"-h:mm"))`

Both formulas check if the time difference (A2-B2) is greater than 0, and if it is they return that difference. If the time difference is less than zero, the first formula calculates the absolute difference and concatenates the minus sign. The second formula yields exactly the same result by using a negative time format *"-h::mm*".

Basically, there are 2 ways to add and subtract time in Excel:

- Using the TIME function
- Using arithmetic calculations based on the number of hours (24), minutes (1440) and seconds (86400) in one day

The `TIME(hour, minute, second)`

function makes Excel time calculations really easy, however it does not allow adding or subtracting more than 23 hours, or 59 minutes, or 59 seconds. If you are working with bigger time intervals, then use one of the arithmetic calculations demonstrated below.

To add hours to a given time in Excel, you can use one the following formulas.

**TIME function to add under 24 hours**

=*Start time* + TIME(*N hours*, 0, 0)

For example, if your start time is in cell A2, and you want to add 2 hours to it, the formula is as follows:

`=A2 + TIME(2, 0, 0)`

`=A4 + TIME(25, 0, 0)`

, the result will be "06/02/2015 11:00", i.e. A4 + 1 hour.
**Formula to add any number of hours (under or over 24 hours)**

The following formula has no limitations to the number of hours you want to add:

=* Start time* + (*N hours* / 24)

For example, to add 28 hours to the start time in cell A2, enter the following formula:

`=A2 + (28/24)`

To **subtract hours** from a given time, you use analogous formulas, and just replace "+" with the minus sign:

For example, to subtract 3 hours from the time in cell A2, either of the following formulas will do:

`=A2-(3/24)`

`=A2-TIME(3,0,0)`

To subtract more than 23 hours, use the first one.

To add minutes to a given time, employ the same techniques that we've just used for adding hours.

**To add or subtract under 60 minutes**

Use the TIME function and supply the minutes you want to add or subtract in the second argument:

=*Start time* + TIME(0, *N minutes*, 0)

And here are a couple of real-life formulas to calculate minutes in Excel:

To add 20 minutes to the time in A2: =A2 + TIME(0,20,0)

To subtract 30 minutes from the time in A2: =A2 - TIME(0,30,0)

**To add or subtract over 60 minutes**

In your calculation, divide the number of minutes by 1440, which is the number of minutes in a day, and add the quotient to the start time:

=*Start time* + (*N minutes* / 1440)

To subtract minutes from time, simply replace plus with the minus sign. For example:

To add 200 minutes: `=A2 + (200/1440)`

To subtract 300 minutes: `=A2 -(300/1440)`

Second calculations in Excel are done in a similar fashion.

To add under 60 seconds to a given time, you can use the TIME function:

=*Start time* + TIME(0, 0, *N seconds*)

To add more than 59 seconds, use the following formula:

=*Start time* + (*N seconds* / 86400)

To subtract seconds, utilize the same formulas with the minus sign (-) instead of plus (+).

In your Excel worksheets, the formulas may look similar to these:

To add 30 seconds to A2: `=A2 + TIME(0,0,31)`

To add 1200 seconds to A2: `=A2 + (1200/86400)`

To subtract 40 seconds from A2: `=A2 - TIME(0,0,40)`

To subtract 900 seconds from A2: `=A2 - (900/86400)`

The Excel sum time formula is the usual SUM function, and applying the proper time format to the result is what does the trick.

Supposing you have a few project times in column B and you want to add them up. You write a simple SUM formula like `=SUM(B2:B4)`

and get the result in the default format, like *hh:mm:ss*.

In some cases the default time format works just fine, but sometimes you may want more, for example to display the total time as minutes and seconds, or seconds only. The good news is that no other calculations are required, all you have to do is apply custom time format to the cell with the SUM formula.

Right click the cell and select *Format Cells* in the context menu, or press Ctrl + 1 to open the *Format Cells* dialog box. Select **Custom** from the *Category list* and type one of the following time formats in the *Type* box:

- To display total time as minutes and seconds:
**[m]:ss** - To display total time as seconds:
**[ss]**

The result will look as follows:

In order to add up more than 24 hours, you use the same SUM formula as discussed above, and apply one of the following time formats to the cell:

Format |
Displays as |
Explanation |

[h]:mm | 30:10 | Hours and minutes |

[h]:mm:ss | 30:10:20 | Hours, minutes and seconds |

[h] "hours", mm "minutes", ss "seconds" | 30 hours, 10 minutes, 20 seconds | |

d h:mm:ss | 1 06:10:20 | Days, hours, minutes and seconds |

d "day" h:mm:ss | 1 day 06:10:20 | |

d "day," h "hours," m "minutes and" s "seconds" | 1 day, 6 hours, 10 minutes and 20 seconds |

To see how these custom time formats may look like in your Excel worksheet, please have a look at the screenshot below, where the same SUM formula is entered in cells A9 to A13:

`=SUM($B$2:$B$4)`

Also, please keep in mind that the time format applied to a cell changes only the display presentation without changing the cell's value. For example, in the screenshot above, cell A13 looks like text, but in fact it's a usual time value, which is stored as a decimal in the internal Excel system. Meaning, you are free to refer to that cell in other formulas and calculations.

To have a closer look at the time formulas discussed in this article, feel free to download our Sample Workbook with Time Calculations.

Now that you know a bunch of different formulas to add and subtract times in Excel, let me show you the tool that can do it all. Okay, almost all :)

Here comes Ablebit's Date & Time Formula Wizard for Excel:

In the *Date & Time Wizard* dialog window, you switch to the *Add* or *Subtract* tab, depending on which operation you want to perform, and do the following:

- Click the
**Show time fields**link in the left part of the window. - Supply values or cell references for the formula arguments. As you fill in the argument boxes, the wizard builds the formula in the selected cell.
- When finished, click the
*Insert Formula*

That's it! For example, this is how you can add the specified number of hours, minutes and seconds to the time in A4:

If you need to copy the formula to other cells, fix all references except the cell containing the original time (A4) with the $ sign like shown in the screenshot below (by default, the wizard always uses relative references). Then double-click the fill handle to copy the formula down the column and you are good to go!

Besides time calculations, the wizard can also add and subtract dates, get the difference between two dates, and calculate age from the birthdate.

If you are curious to try this tool in your own worksheets, you are welcome to download the 14-day trial version of our Ultimate Suite which includes this as well as 60 more time saving add-ins for Excel.

This is how you calculate time in Excel worksheets. To learn other ways to manipulate dates and times in Excel, I encourage you to check out the resources at the end of this article. I thank you for reading and hope to see you on our blog next week!

Excel formulas
CSV
Excel functions
Print
Financial functions
Vlookup
Merge data in Excel
SumIf
CountIf
Excel Compare
If statement
Excel Charts
Pivot Table
Conditional formatting
Excel formatting
Excel duplicates
Excel date
Excel tips
Excel macro
Outlook
Google Sheets
Outlook duplicates
Shared email templates

Category: Excel Tips and How-to

## 614 responses to "How to calculate time in Excel - time difference, adding / subtracting times"

Hi,

I have a problem working with the excel formula to calculate the End Date & Time from Start Date & Time for given Duration.

Its a 24/7 work but there is a chance for festival and natural disaster holidays so will maintain the holiday list separately. We have 2 shifts a day. each shift has below details

--------------------------------------------------------------------------------------------------------------------------------------------------------

Example :1 ( Day Shift )

----------------------------------

Start Time Stamp || Project Hours || Daily Shift Start || Break1 Start || Break1 End ||

1/7/2021 11:45 AM 12 10:00 AM 11:15 AM 11:30 AM

Lunch Start || Lunch End || Break2 Start || Break2 End || Daily Shift End || Dead Line

1:00 PM 1:30 PM 3:00 PM 3:15 PM 6:00 PM ????

--------------------------------------------------------------------------------------------------------------------------------------------------------

Example :2 (Night Shift)

----------------------------------

Start Time Stamp || Project Hours || Daily Shift Start || Break1 Start || Break1 End ||

1/7/2021 11:45 AM 28 6:30 PM 8:15 PM 8:30 PM

Lunch Start || Lunch End || Break2 Start || Break2 End || Daily Shift End || Dead Line

9:30 PM 10:00 PM 1:30 AM 1:15 AM 2:30 AM ????

--------------------------------------------------------------------------------------------------------------------------------------------------------

Conditions

=======================

Dead Line with Date & Time

Excludes the Holidays List

Calculate only the working hours

Exclude the Break & Lunch hours

Hello!

Your request goes beyond the advice we provide on this blog. This is a complex solution that cannot be found with a single formula. If you have a specific question about the operation of a function or formula, I will try to answer it.

Thank you very much

Very nice

Hi Svetlana, you are obviously very skilled at using Excel. Your page on Excel time calculations came up in a search. I am hoping you can assist me in resolving a couple of issues within an existing Excel sheet i have made for home video logs of old videotapes.

I have many home videos of my kids growing up and I am entering the date, location, person, place, etc. information of each video into an Excel sheet.

I tried to copy and paste a sample of the heading of my sheet but the website would not allow me to do so. Let me know if there is a way to send you the sheet. If not here are the column headings:

DVD # Tape# Source Type Date of Event Time Start Time End Length (HR:MN:SC) Subject Names Event Name Location Notes

If you already have a sheet for my needs that would be great!

I would like your expertise on two matters. The first involves time calculations.

I found where I can format cells for Time/37:30:55 to help me calculate the time durations by entering the data in the Time Start and Time End columns to determine the duration in the Length column (this is calculated across a row. I also entered a formula to calculate the total duration in the Length column (going down) to determine the total length of the entire video tape or the total of all of the events.

Since the rows could be multiple because of the number of persons and descriptions of one event, I have to enter these formulas manually. Is there a way to put a formula into the Length (duration) column so when I enter the date in Time Start and Time End it will automatically subtract the Start from the End. For instance, one Length could be cell G3 and G5 and may skip to G9. Of course the end point to total the event durations in the Length column for the entire videotape would vary also since I do not know what row will be the last one.

The second request is hopefully more simple. I want to make sure that I am able to filter the logs if want to find all of the video clips in one video tape say of John or Disneyland or birthday. For instance in a cell naming characters within one event or row as I described above should I put a space or comma or colon between each word I want to search later? Before I start all of this data entry I want to make sure i have it formatted correctly. This will be important if I combine all of the individual video logs into one massive excel sheet to possible search for all of John's birthdays through the years to do a highlight movie.

Sorry for the lengthy request but I am a novice to Excel and making requests on forums.

Thank you in advance for your assistance and I look forward to your response.

Tony

In normal excel sheet I am try to calculate manpower efficiency which need time starts and time end. What is the formula for time starts if the person starts work by pressing "Y" in beside column. I tried with now() formula but it's keep on changing. I need once the activity start time should not be changed when the activity is closed and centering the closing time. I need in if programme

Hello!

To prevent your date from automatically changing, you can use several methods. Read this comment.

Hello,

how to write coming late formula for 3 shifts (24 H).

1- 00:00 AM to 08:00 AM

2- 08:00 AM to 04:00 PM

3- 04:00 PM to 00:00 AM

Thank you for the 'time in 1904 format' tip.

In a Mac it's under Excel preferences, Calculation then tick 'use 1904 date system'

I have a question here. How to get the hour after minus from 73:50 - 70:91?

my results show #value

Hope to hear from you soon.

Thanks.

Hello!

Time cannot be written as 70:91. There cannot be more than 60 minutes in an hour. If instead of 70:91 you write 71:31, then you will succeed.

How to calculate difference of below time stamp

Respone Time (Before Entry) Respone Time (After Entry)

2021-04-20-17.05.26.661101 2021-04-20-17.05.27.149143

2021-04-20-17.05.56.336787 2021-04-20-17.05.56.507989

2021-04-20-17.05.57.052277 2021-04-20-17.05.57.129936

2021-04-20-17.06.58.825463 2021-04-20-17.06.58.913969

Hi,

Reread the article above. It describes in detail how to calculate the time difference.

To convert your text to date and time, I recommend reading the manual "How to convert text to date and number to date in Excel" and this commentary to it.

This should solve your task.

Looking to calculate the time difference excluding weekends and business hours for the time a user submits a support request. Weekends are sat/sun and business hours are 8-5.

Example time of the support request:

Submitted at 7:00am on Friday 5/7/21.

Request completed at 10:30am on Monday 5/10/21.

The answer when calculated manually would be 10.5 hours to complete the request.

What would the formula be for this?

Sorry, 11.5.

Hello!

If I understand your task correctly, the following formula should work for you:

=IF(NETWORKDAYS.INTL(A2,B2,1)=1,MIN(TIME(HOUR(B2),MINUTE(B2),0),TIME($C$1,0,0))-MAX(TIME(HOUR(A2),MINUTE(A2),0),TIME($B$1,0,0)),(NETWORKDAYS.INTL(A2,B2,1)-1)*($C$1-$B$1)+MAX(0,MIN(TIME(HOUR(B2),MINUTE(B2),0),TIME($C$1,0,0))-TIME(8,0,0))+TIME(18,0,0)-MAX(TIME(HOUR(A2),MINUTE(A2),0),TIME($B$1,0,0)))-IF(TIME(8,0,0)-(A2-INT(A2))>0,TIME(8,0,0)-(A2-INT(A2)),0)

A2 - start time

B2 - end time

B1 -start workday (8)

C1 - end workday (17)

The answer calculated 9+2.5=11.5 hours

I hope I answered your question. If something is still unclear, please feel free to ask.

What if not considering Start workday and end workday and instead just considering 8 hrs a day

Hi!

You can calculate the number of working days using the NETWORKDAYS.INTL function and multiply that result by 8.