How to calculate time in Excel - time difference, adding / subtracting times

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.

How to calculate time difference in Excel (elapsed time)

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.

Formula 1. Subtract one time from the other

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: Calculating time difference in Excel

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: The elapsed time is displayed differently depending on the applied time format.

Note. If the elapsed time is displayed as hash marks (#####), then either a cell with the formula is not wide enough to fit the time or the result of your time calculations is a negative value.

Formula 2. Calculating time difference with the TEXT function

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

Calculating time difference with TEXT function

Notes:

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

Formula 3. Count hours, minutes or seconds between two times

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) Calculating hours between two times in Excel

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 Calculating total minutes between two times in Excel

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 Calculating total seconds between two times

Note. For the results to display correctly, the General format should be applied to the cells with your time difference formula.

Formula 4. Calculate difference in one time unit ignoring others

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. Calculate time difference in one unit ignoring others

Note. If the end time is less than the start time (i.e. the result of the formula is a negative number), the #NUM! error is returned.

Formula 5. Calculate elapsed time from a start time to now

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 below returns the following results, provided you've applied an appropriate time format to column B, h:mm in this example:

=NOW()-A2 Calculating elapsed time from a start time to now

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: Calculating elapsed time over 24 hours

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 Calculating elapsed time without dates

Note. The elapsed time is not updated in real-time, it refreshes only when the workbook is reopened or recalculated. To force the formula to update, press either Shift + F9 to recalculate the active spreadsheet or hit F9 to recalculate all open workbooks.

Formula 5. Display time difference as "XX days, XX hours, XX minutes and XX seconds"

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" A user-friendly Excel time difference formula

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 :) Excel time difference formula that ignores zero values

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" Subtract the start time from the end time and apply the custom time format to the cell.

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 How to show time over 24 hours, 60 minutes, 60 seconds.

How to calculate and display negative times in Excel

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

Method 1. Change Excel Date System to 1904 date system

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. Changing to the 1904 data system

Click OK to save the new settings, and from now on negative times will be displayed correctly, like negative numbers: In the 1904 date system, negative times are displayed like negative numbers

Method 2. Calculate negative time in Excel with formulas

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". A formula to calculate negative times in Excel

Note. Please keep in mind that unlike the first method that treats negative times as negative numeric values, the result of the TEXT function is always a text string that cannot be used in calculations or other formulas.

Adding and subtracting time in Excel

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.

How to add or subtract hours to time in Excel

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) TIME function to add under 24 hours

Note. If you try adding more than 23 hours with the TIME function, the specified hours will be divided by 24 and the remainder will be added to the start time value. For example, if you try to add 25 hours to "6/2/2015 10:00 AM" (cell A4) using the formula =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) Universal formula to add hours to a given time in Excel

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.

How to add / subtract minutes to time in Excel

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) Adding and subtracting minutes in Excel

How to add / subtract seconds to a given time

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)

How to sum time in Excel

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 the one below and get the result in the default format such as hh:mm:ss.

=SUM(B2:B4) A SUM formula to add up times in Excel

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: Apply the custom time format to display total time as minutes and seconds, or seconds only.

How to sum over 24 hours in Excel

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) Adding up more than 24 hours in Excel

Note. The above custom time formats work for positive values only. If the result of your time calculations is a negative number, e.g. when you are subtracting a bigger time from a smaller time, the result will be displayed as #####. To display negative times differently, please see custom format for negative time values.

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.

For more information, please see How to calculate and show over 24 hours, 60 minutes, 60 seconds.

Date & Time Formula Wizard - quick way to calculate times in Excel

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: 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: Add hours, minutes and seconds to the original time in Excel

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! Formula to add hours, minutes and seconds to time in Excel

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 evaluation version of our Ultimate Suite below.

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!

Available downloads

Excel Time Calculations - formula examples (.xlsx file)
Ultimate Suite - trial version (.exe file)

960 comments

  1. I am unable to find the difference between two time given below:
    Last time is 22:59
    Current time is 07:45
    Pls help me.

  2. This is quite useful.

    I was looking something similar to NETWORKDAYS(), which ignores the non working days between two dates.
    Is there anything similar for time as well.
    e.g Start time: 3/11/2016 4:00:00 PM
    End Time: 3/14/2016 4:00:00 PM
    If we do (ET-ST)*1440 = 4320 min
    My expectation is 1440 min (As 3/12 & 3/13 is Sat & Sun)

    Is there a way to calculate this

  3. When adding over time in a weekly sheet if a person have worked 3 and half hrs. Should i use 3.5 or 3:30 and what formula should i use for the total

  4. please anyone reply ,that how to sum time this forula,(0days,0hour,0minute and 0second)

  5. I need to count times which are in 1/100 seconds. Like start and finish times from actual running time (12:00:00:00) and (12:03:21:12)
    My Excel 2007 doesnt seem to do this?

    • Sorry, rushed a little...solved...you can write your own format to custom, like h:mm:ss,00

  6. 11:30
    What time will it be in forty minutes? Write your answer using numbers

  7. hello,

    A B C
    1:22:17 AM 1:29:16 AM 00:06:59

    suppose time is 6 minutes 59 seconds

    Is it was displayed as 7 minutes

    I want a formula pls help us

  8. Start time End time
    1/31/2016 21:41 1/31/2016 22:32
    1/31/2016 19:59 2/1/2016 10:01
    1/31/2016 18:25 2/3/2016 16:58
    1/30/2016 18:59 1/30/2016 19:34
    1/30/2016 14:11 2/3/2016 8:22
    1/30/2016 13:08 1/30/2016 15:19
    1/30/2016 12:26 1/30/2016 13:28
    1/30/2016 11:45 2/2/2016 7:35
    1/30/2016 11:42 1/30/2016 12:44
    1/30/2016 9:23 1/30/2016 9:29
    1/29/2016 18:06 1/29/2016 18:47
    1/29/2016 17:55 1/29/2016 18:12
    1/29/2016 17:36 1/29/2016 18:45
    1/29/2016 17:28 2/1/2016 13:42
    1/29/2016 17:18 2/2/2016 18:08
    1/29/2016 16:26 2/3/2016 11:59
    1/29/2016 16:02 1/29/2016 17:54
    1/29/2016 15:36 1/30/2016 19:37
    1/29/2016 14:58 2/1/2016 8:12

    looking at the above, i want to calculate how many hours/minutes/seconds it takes ignoring Saturday's and Sunday's and any time between 5pm and 8am.Is it possible to have a formula like this?

    • Hello, Barbara,

      To get the correct result you need a VBA script. Even if there may be a formula for this, it will be too complicated.

  9. Hi I just want to do an analysis for orders received for every 30 mins. in an Hour. I have the data in the following format:

    12/02/2016 00:01:13
    12/02/2016 00:02:30
    12/02/2016 00:02:56
    12/02/2016 00:03:16
    12/02/2016 00:04:15
    12/02/2016 00:03:34
    12/02/2016 00:49:07
    12/02/2016 00:49:31
    12/02/2016 00:49:38
    12/02/2016 00:50:23
    12/02/2016 00:50:48
    12/02/2016 01:03:56
    12/02/2016 01:03:53
    12/02/2016 01:04:12
    12/02/2016 01:33:26
    12/02/2016 01:34:52
    12/02/2016 01:35:51
    12/02/2016 01:37:15
    12/02/2016 01:37:46
    12/02/2016 01:39:18

    i want the above data to be like:

    12/02/2016 00:01:13 12:00-12:30 am
    12/02/2016 00:49:31 12:30-01:00 am

    Please let me know if this is feasible.

  10. Dear mam,

    How to exclude sunday when we have calcuated time with below format.
    12/02/2016 1:30 PM -12/02/2016 10:00 AM =

    Reg.
    Shashi

  11. If I have to work 37.5 hrs in a week (5 days), how do I calculate :

    a) how many hours I have to do in one day for 9 days (to get one day off a fortnight).

    b) How many hours I have to do in one day for 19 days (to get one day off a month).

    THEREFORE 37.5 HRS PER WEEK = 7HRS AND 30MINS PER DAY FOR 1 WEEK.

    I GUESS I JUST NEED THE FORMULAE TO CALCULATE (37.5*2)/9 (IN TIME) AND 37.5*4/19 (IN TIME) PLEASE!

  12. DEAR SIR/MAM

    IF DATA IS LIKE THIS
    8:30 6:30 HOURS SHOULD SHOW LIKE 10:00 IN EXCEL FILE PLEASE TELL FOIRMULA FOR THIS

  13. How to calculate night duty hours from following times. NDA hours=22:00 to 06:00.
    A1=31-01-16 21:00
    B1=01-02-16 08:00

  14. Hi

    I need help creating a formula in excel that counts the number of transactions between certain time zones in a day. Each transaction is timed, I want to breakdown the daily list I get into 2 hourly segments counting actions between 09:00-11:00,11:00-13:00,13:00-15:00 etc.

    Thanks

  15. gud morning madam
    would please help me for getting the sum total of time and minutes in horizontal type
    (ie:8:15(15times) & 6:45(3times)i got the total in vertical but horizontally how please )

  16. Hi,

    I have a spreadsheet that works out the difference between 2 times (I just manually type in the time; 15:27)
    Then for the difference I just use a simple subtraction, which if 1 is 11:30 and the other is 16:00, it says 4:30, which is great.
    I want the difference to only be between 09:00-17:00 so if the first time is 15:30 and the second is 10:30 I want the time difference to be 3hours.
    Is this possible as I don't use dates in the spreadsheet?

    Thank you

  17. How to calculate two different row time is more than 4 hrs.fail or less than 4hrs pass
    01/01/15 10:00
    02/01/15 14:00

  18. I need to calculate the difference between two times in the same column, in a timetable. I need the difference between each time in the column. Say, the time between B5 and B4 is 40 minutes. The times go down to B94.

    I used =TEXT(B5-B4,"h:mm") which was simple enough and worked, in the format I needed, (:40) in the first cell, but it didn't work if I extended the selection to all the cells in the column. The subsequent cells are showing the same answer, but are not correct. I have the cells in the time format, "1:30 PM". How can I get it to work for each iteration?

    The second part of the question-if the previous time is larger that the following time, like 1:30 - 12:45. I get a VALUE alert. I know this is because you can't have a negative number. I tried to write an if statement: If(B4>B5), but I couldn't get it to work.

  19. Hi,

    Firstly this page is very useful, thank you for creating it.

    I am working on a project where I need to deal with time. So in between time I need to remove the regular intervals.

    Example:
    If I am performing a certain tasks
    Task 1: 6:00 AM to 9:00 PM
    Task 2: 9:00 AM to 12.30 PM
    Task 3: 12.30 PM to 2.30 PM

    I need time difference between them and also I want the break time to be removed.

    Break 1: 8:00 AM to 8:15 AM
    Break 2: 11.00 AM to 11.30 AM
    Break 3: 12.50 Pm to 1.00 PM

  20. For anyone that runs into this, I fixed it using MOD((TIME(HOUR(L5),MINUTE(L5),)-TIME(HOUR(J5),MINUTE(J5),)),1))-S5 where s5 is my 30 min lunch formatted as Time(0,30,0). Cells L5 and J5 are my preformatted cells that export from our time clock and they look like this:
    J5 L5
    01/04/2016 07:00 AM 01/04/2016 04:32 PM

  21. Hi,

    How do you subtract total Hours:miniutes ex. 37873:34 - 37152:57 to return xxxxx:xx as your answer.

  22. Hi, I am having an issue with times and dates that go from PM to AM. If one work shift is 3:30 PM - 12:00 AM and another is 3:30 PM to 01:00 AM, I cannot get the hours to calculate correctly using the 24 hour format. If I subtract the times and multiply by 24, I get -15.75. At first I thought I should multiply by -12 to correct for this error, and that gets me close, but it is still incorrect. Can you help me with this?

  23. hi,

    can you please help me!
    I am trying to figure out how to calculate my average running times, for example, I do a lot of 5km runs and my times vary between 25 and 32 minutes, there would be seconds as well, I am using excel 2016 and I am new to excel, I tried doing it myself already and I am only getting average times, as in actual times, for example, if I have a time of 35:07 it comes up in excel as 00:35:07 so it looks like normal time in 24 hour clock? how can I do this please? your advice is very much appreciated.

    • Hello, Eddy,

      Please use the formula =AVERAGE(A1:A4), where A1, A2, A3, A4 are times like 0:35:07, 0:25:15 and so on.

  24. This has been so useful to me in helping me with accounting and management ...THANKS SO MUCH!! :)

    This is PERFECT !!

  25. Hi Guys,

    I Have data in hh:mm:ss format but some cells starts with only " : " eg :44:00

    i have to daily download the dump and I correct it manually is there any formulae to correct this...

    • Hello, Asaad,

      To correct these values you can add a helper column with this formula:
      =IF(LEFT(A1; 1) = ":"; TIMEVALUE("0" & A1); A1)

  26. i Am looking formula that if the both the time formats are different then how can we subtract.
    Ie:Start time 18:59:59 and end time 07:15PM

    • Hello, Prasanna,

      Please use the following formula
      =IF(OR(IFERROR(FIND(A2; "AM"); FALSE); IFERROR(FIND(A2; "PM"); FALSE)); TIMEVALUE(SUBSTITUTE(SUBSTITUTE(A2; "PM"; " PM"); "AM"; " AM")) - A1; A2-A1)

      where A1 = 18:59:59 and A2 = 07:15 PM

  27. So Clever. this blog give me solution. many thanks for help

  28. I am looking for a formula that calculates minutes or hours when timeframe extends from PM to AM. For example, 9:00 AM to 12:30 AM should equal 3.5 hours or 210 minutes.
    Thanks!

    • Hello, Farhan,

      Please use the formula below:
      =HOUR(A2-A1)*60 + MINUTE(A2-A1)

      It will return the number of minutes between A2 and A1.

  29. I work at a car factory and i created a spread sheet that calculates how many vehicles an hours can be made with a certain amount of parts that we have on hand. I wanting my spread sheet to automatically deduct the number of vehicles that can be made with the part on hand every hour. Can anyone help me out.

  30. How do you add two dates together that are greater than 31 days and still keep it as a number, not a text?

    I am using the following formula:

    =(H4-B4)-((INT(H4)-INT(B4))-(NETWORKDAYS(B4,H4,$M$6:$M$15))+1)

    This formula works fine on all dates that are lower than 31 days.

    I have one date that starts on 6/5/2015 11:29:28 AM and completes on 10/16/2015 3:29:09 PM, the formula should be 95 days total time and the answer the formula gives me is: 2 d, 3 h, 59 m.

    How do it get it to give me the correct timelapse of 95 days in days, hours, minutes format. It has to be in a numerical format so I can average out the completion time for the total year.

    • Hello, Michelle,

      Please use the formula below. If will return the difference in the needed format between A2 and A1:
      =INT(A2-A1) & " d, " & HOUR(A2-A1) & " h, " & MINUTE(A2-A1) & " m"

  31. I need to calculate am and pm start and finish times
    1700-0500
    0500-1700
    1000-1800
    1800-0500 etc

  32. Hi Svetlana,

    Could you tell me how I could perform a subtraction for multiple days at different times each. For instance,

    Start date and time : 5th April 2015 10 am

    Data:
    5th April 2015 11.30 am
    5th April 2015 4.30pm
    6th April 2015 3.30am
    8th april 2015 8.30am
    9th April 2015 10am

    I would like to calculate the total cumulative time at the end and possibly in between each interval by subtracting the starting date and time. I could manually do it using the arithmetic method but if I have 100 data it will take a really long time.

    Would be great if the output could be delivered in a single cell.
    Appreciate your thoughts on it.

    • Hello, Sean,

      Please insert a helper column with this formula:
      =(DATE(INT(MID(A2;FIND(" ";A2;FIND(" ";A2)+1)+1;4));MONTH(1&LEFT(MID(A2;FIND(" ";A2)+1;FIND(" ";A2;FIND(" ";A2)+1)-FIND(" ";A2)-1);3));INT(LEFT(A2;FIND("th";A2)-1)))+TIMEVALUE(SUBSTITUTE(MID(A2;FIND(" ";A2;FIND(" ";A2;FIND(" ";A2)+1)+1)+1;2);".";"")&":"&IF(ISERROR(FIND(".";A2));"00";MID(A2;FIND(".";A2)+1;2))&" "&IF(ISERROR(FIND("am";A2));"PM";"AM")))-(DATE(INT(MID($A$1;FIND(" ";$A$1;FIND(" ";$A$1)+1)+1;4));MONTH(1&LEFT(MID($A$1;FIND(" ";$A$1)+1;FIND(" ";$A$1;FIND(" ";$A$1)+1)-FIND(" ";$A$1)-1);3));INT(LEFT($A$1;FIND("th";$A$1)-1)))+TIMEVALUE(SUBSTITUTE(MID($A$1;FIND(" ";$A$1;FIND(" ";$A$1;FIND(" ";$A$1)+1)+1)+1;2);".";"")&":"&IF(ISERROR(FIND(".";$A$1));"00";MID($A$1;FIND(".";$A$1)+1;2))&" "&IF(ISERROR(FIND("am";$A$1));"PM";"AM")))

      Here A1 = 5th April 2015 10 am
      A2 = 5th April 2015 11.30 am
      A3 = 5th April 2015 4.30pm
      and so on

  33. Hi,

    This page is very helpful, but I have one question.

    Is there a way to do a time calculation in a single cell?
    I would like to enter something like this, which is similar to what you can do with regular numbers:

    =14:03:14 - 13:40:40

    And have the cell display the time difference, it seems a waste to use three cells to do time math.

    Any help would be great,

    Paul

      • Cell A1(14:03:14) Cell A2(13:40:40) and this formula =MOD(A1,A2)*24 RESULT 9:01:36 i DON'T KNOW if this will help you!

  34. i need some help i have these two dates(11/16/2015 02:32:19 PM 11/16/2015 02:32:19 PM),when i substract them to get the differences, the result is (#VALUE!)
    Any solution i tried everything but the result didnt change best regards

    • Hi H.K.

      when I entered those dates in my test worksheet (cells A1 and A2), the formula =A1-A2 returns 0:00:00 exactly as it should because the dates are identical up to a second. What formula do you use?

      • hello i am using the same one you used and other ones but it gave me the same results

        • any answers???!!!!

          • H.K,

            Sorry, it's hard to determine the cause of the problem without seeing your data and formulas. The most obvious thing that comes to mind are dates formatted as text.

            To check your formula, you can type those 2 dates manually in a new worksheet, and then enter the formula. If the formula works there, then the problem is most likely with the formatting of your source data.

      • The best formula i use all the time is =(A2-A1)*24 or the best one is =IF($A1="","",(MOD(A2-A1,1))*24) IF cel A1, 2, 3, and so on is empty i said give me empty other wise subtract A2 to A1 and Multiply 24. This formula will never give you a negative. Example. if you have started working 4:00 PM and ended 1:00 AM without using MOD, it will give you -15 but Mod will give you exactly hours of work which is 9 hours. Good Luck.
        Also if you want to subtract 2 date i use this =DATEDIF(A1,A2,"D")+1 Will give me exactly how many days. if you need Years, change D to Y. Month use YM.

        Good Luck!

        • hello i have a problem , i have 2 time-in & time-out ex.time-in A1=9:05 AM ,time-out A2= 11:45 AM , time-in A3= 12:00 PM , time-out A4=6:00 AM . how to calculate this in 1 sheet or 1 Code ? Every body Can Help me !!!???

          • i mean in A5 or in 1 code solution ??

            • in 1 formula ?

  35. Hi,
    i have a Problem in calculation of Employee Time-in and Time-Out Time-in is 9:00am and Time Out is 24:30 Am then how to get result in proper format
    Thanks

  36. I want to enter swimmers times, eg. 1.26.00, 1.20.00 1.18.00 etc and find the fastest time which would be 1.18.00 The formula for MIN works alright if it is just in seconds, 56.45 and 54.25 but soon as I enter minute it comes up with error.

    Also to show the improvement from slowest time to fastest.

    Hope you can help. Thankyou

  37. My result in Excel is in fol format
    45:30 i-e (45 Hours 30 Mins)
    Now i want to convert it into days and minutes i-e 1 day 21 hours and 30 mins.my start time is 1800 hrs, so result may be shown like d+2, 1530 hrs.
    Kindly help me in this regard

  38. I am looking for a formula that gives me a difference of time,
    For eg. A1 = 8:00 PM
    B1 = 5:00 AM

    I want the difference of hours in C1 cell.

    And same should be applied for:
    A2 = 8:00 AM
    B2 = 5:00 PM

    Kindly help me with this

  39. hey, thank you for such a detailed explanation of using various methods to calculate time... really informative.

    i have date and time in two different columns. Which is actually the Login and logout time & i want to calculate the difference. In some cases the log out is after 11.59pm and i'm not getting the exact difference.

    If i need to combine both the date and time column and then find the difference, how do i do it?

    Or if there another way!

  40. If the data is something like this, how do we calculate the (1) actual time taken (2) average time taken for a month.

    01.07.2014 00:00 10:26:16 AM
    01.07.2014 00:00 11:55:09 PM
    02.07.2014 00:00 11:40:59 AM
    02.07.2014 00:00 2:54:54 PM
    02.07.2014 00:00 3:15:37 PM
    02.07.2014 00:00 11:57:43 PM
    03.07.2014 00:00 12:11:55 PM
    03.07.2014 00:00 2:58:01 PM
    03.07.2014 00:00 3:25:53 PM
    03.07.2014 00:00 8:45:34 PM
    04.07.2014 00:00 2:42:27 PM
    04.07.2014 00:00 9:16:39 PM
    04.07.2014 00:00 9:17:40 PM
    04.07.2014 00:00 9:18:03 PM

  41. Need help with time/date data

    I need to compare two excel sheets. These two excel sheets will have date/time data. I want to ignore the date/time during comparison. The date/time will display in the bottom of the sheet but not specific to one particular cell.(since the excel is based out of the report).

    Any help is appreciated.

  42. hi

    my question is
    how to make sheet for automatic change amount change in time on my computer time ???

    for example
    >>>>> bank charges time 11:00 am to 3:00 pm is 17
    And after 3:00 Pm bank charge is 17+6 = 23
    How to use formula and condition if or other please prescribe

    How I make this type sheet time to time change sheet

  43. need help on the formula for the difference in minutes:

    ex:
    A1 - expected time
    B1 - delivery starts
    C1 - time delivered

    What if the time is

    18:00, 17:30, 17:45 // what is get is 23:45

  44. I am looking for a formula that would give me the time interval between a start time and different time intervals every hour ... for example cell B2 start time is 6:00am, in cell C1 I want to enter 1.5 and in cell B2 I want excel to calculate the formula as indication 1 and one half hour interval was worked.

  45. I am looking for a formula that calculates minutes or hours when timeframe extends from PM to AM. For example, 9:00 PM to 12:30 AM should equal 3.5 hours or 210 minutes.
    Thanks!

    • Greg, please let me know if you have ever solved this issue, i too am trying to figure this out. Thanks.

      • I am also trying to solve this problem. If anyone could help it would be greatly appreciated.

        • Hi there,

          This can be calculated as: (12:30am-9:00pm)*24= -20.5 hours.

          Or: (12:30am-9:00pm)*1440= -1230 minutes

      • Same:- Sells C27= 06:52:00 PM and D27= 03:14:00 AM. =TEXT(D27-C27,"h:mm") Result:- #VALUE!

  46. I Need Formula for Calculate To different Time To numbers.
    (i.e Cell A1= 11 Hour, Cell B1= 30 min) I need Ans is 11.5
    Please give me salotion

    • Hi Ramesh,

      If A1 and B1 are numbers, 11 and 30 respectively, you can use the following formula: =A1+(B1/60)

      • Thanks

  47. Hi,

    I have a time in negative as -135:45 and want this to convvert in day by in negative balance

    Kindly help

  48. Hi,

    I need a formula to calculate the time difference with sum subtraction on time

    for example:

    7/25/2015 08:42 PM - 7/26/2015 07:42 PM = 23:00

    but i need to avoid the time of 13 Hrs ( 7/25/2015 9:00PM to 7/26/2015 8:00 AM) to show me only 10 hrs

    Kindly help me on this

    Thanks in advance on your kind help.

    • I need a formula to calculate the time difference with sum subtraction on time

      for example:

      19:57 PM -8:10 AM = 12:13 HRS

      but 19:57 PM -8:10 AM to show me only 11:47 hrs

      Kindly help me on this

  49. If the result is a negative number, the TEXT formula returns the #VALUE! error.

    How can I avoid getting this error message? I am not able of calculating the average time in a range that was previously calculated as time difference.

    So if a cell was previously calculated as a time difference and the results was negative, I am getting #VALUE!

    • Hi Derek,

      If you want to display negative time differences as well, like -1:00, then you can use either of the following formulas:
      =IFERROR(TEXT(B2-A2, "h:mm"), CONCATENATE("-",TEXT(ABS(B2-A2), "h:mm")))

      =IF(B2>=A2,(TEXT(B2-A2,"h:mm")), CONCATENATE("-",TEXT(A2-B2, "h:mm")))

  50. That's so useful.
    Thanks a lot.

    • Very useful! Thanks.

Post a comment



Thank you for your comment!
When posting a question, please be very clear and concise. This will help us provide a quick and relevant solution to
your query. We cannot guarantee that we will answer every question, but we'll do our best :)