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

The tutorial explains different ways to calculate times in Excel and demonstrates several methods of adding times and calculating time difference. You will learn a few useful formulas to sum times and add hours, minutes or seconds to a given time. Continue reading

Comments page 13. Total comments: 1023

  1. Hi,
    I am trying to figure out how many hours worked in a day using military time. I am also trying to find the difference of hours worked from 8.5 hours. I have to work 8.5 hours a day. Sometimes I work more and sometimes I work less. I would like the formula to highlight a negative difference so I can make sure I work 8.5 hours a day.
    Thanks in advance for your help.

  2. how to figure out the diffrence between time in days if some of them have end date and some dont?

    1. Hello SHAFF!
      If I understand your task correctly, the following formula should work for you:

      =IFERROR(DATEDIF(A1,A2,"d"), DATEDIF(A1,TODAY(),"d"))

      I hope this will help, otherwise please do not hesitate to contact me anytime.

  3. do im doing something wrong :(

  4. can someone help me with this formula I try many time to calculate the hour time to make total duration time and still I am stuck ca some one help=(IF(E4>F4,1+F4,F4)-E4)*X1440 me on that. It's not calculating the duration on time i am try to calculated this formula but its not helping

    1. Hello Caraball!
      Please clarify what time is there in your cells F4 and E4 (dd:mm:yy hh:mm:ss or hh:mm:ss) and what result and in what format you would like to get. I won’t be able to help you without more detailed information on your problem.

  5. AfterDifference in time than roundup gives wrong results when start time and end time is equal ROUNDUP((C3-D3),0)

    1. Hello Manoj!
      For me to be able to help you better, please describe your task in more detail. It’ll help me understand it better and find a solution for you. Thank you.

  6. Hi,
    I have Excel sheet where open Date is available in A column, And Time is available in B column, and closing date & time available in C & D Column. How can i find total time duration between open date & closing date. Thank you for your advise.
    BR,
    John Paul.

    1. Hi John,

      The formula below will return you the number of days between open & closing date:

      =INT(C1+D1-A1-B1)

      In order to calculate this duration in hours, please use the following formula instead:

      =TIME(,(C24+D24-A24-B24- INT(C24+D24-A24-B24)) *24*60,)

      Note! Don't forget to set the Time format for cell E1.

  7. Hi, SIR/MADAM
    iam SRI SINDHU G. SADHU
    i have to calculate time in calculate time i 24 hr formate and i have to mention time without ("AM","PM") how t calculate with formula in excel
    for eg
    if i state today 07:00 and i completed next day at 10:00 hear 07:00 is 7am and 10:00 is next day 10am hear i done my work above 24 hr (24 hr and "+" 3 hr extra) this how i can calculate with formula.....

    thank you

  8. How can I convert times to decimals in military time? I'm trying to write a sheet where I input time in and time out using 4 digit military time (6 AM as 0600, 2 PM as 1400), and receive total hours worked. For example, I have time in as 0800, Time out as 1630, and I'd like to get an answer of 8.5 for the number of hours worked. Not 8:30. No colons. Just decimals where half hours are displayed as .5.

    Thank you

    1. Hello Steve,

      Supposing that your times are in A1 and B1 (800 and 1630 accordingly), the following formula will do the trick for you:
      =(TIME(LEFT(B1, LEN(B1) -2), RIGHT(B1, 2), )-TIME(LEFT(A1, LEN(A1)-2), RIGHT(A1, 2), ))*24

  9. I am needing a formula that subtracts hours worked from 40. I am needing to know the left over hours. Basically I need it to subtract worked hours for the week let’s say 25.50 from 40 hours allowed for the week and give me the sum of that. So 40 - 25.5 =14.50

    1. Hello Amber!
      If you enter working hours in the hh:mm:ss format, you can find the sum with the help of ordinary addition. Suppose you type the time in cells B2:B7 and get the sum in cell B8. However, when you sum several time intervals, the result can turn out to be over 24 hours. In this case, Excel resets the sum to zero and starts the operation anew. To show the correct sum of working hours, please apply a special format to B8: open the Format Cells dialog window, go to Number -> Time and choose "37:30:55" from the Type list. Then enter 40:00:00 which is your maximum working time in a separate cell, e.g. C1. After that, change the formula in cell B8 to see the left-over hours:

      =IF(C1 < SUM(B2:B7), "Over 40 hours on "&TEXT((SUM(B2:E7)-C1), "hh:mm"), C1-SUM(B2:B7))

  10. Ok, Thanks for your response, however I was not able figure out where to put that, should I put it in the very beginning? I just couldn't get it to work.I have IN, OUT, IN, Out, and if I put in say 6:30 for the first in without any of the others populated, the total time says 17.25 Hours, and I would like it to say 0 until I enter a out time. Thanks a lot for helping!

    1. Hello Amos!
      Please use the formula below:
      =IF(COUNTA(C3:F3)>1, ((IF(C3>D3, D3+1, D3)-C3)*24)+(IF(E3>F3, F3+1, F3)-E3)*24, "")

      1. Hi Alexander, Thanks so much for the formula that you posted, and it works great for when I enter the IN time in the morning, but when I enter the IN time after lunch it shows the 16.5 hours again. I suppose I just need to add something? I am lost when it comes to these long formulas. So I have IN, OUT, IN, OUT I enter the time to the closest 15 minutes, then the total column shows the hours. Please let me know if you have any thoughts to get the time to show only the hours in the forenoon if I enter the IN time in the afternoon. Thanks!

        1. Ok, so what I would like is if G3 (which is the total hours) does not show a total unless D3 or F3 is populated. Currently I have this formula in G3.
          =IF(COUNTA(C3:F3)>1, ((IF(C3>D3, D3+1, D3)-C3)*24)+(IF(E3>F3, F3+1, F3)-E3)*24, "")
          Currently it shows 17 Hours if I have a time in E3 but not F3. It seems like C3 and D3 are working exactly how I want them. Thanks a lot! Amos

        2. Hello!
          Check what values you enter in C3 D3 E3 and F3. If only one value is filled, the formula does not count time. Give an example of the source data and the expected result.
          It’ll help me understand it better and find a solution for you. Thank you.

  11. Thank you.

  12. I have a formula to calculate time in excel, which works good, but if I clock in at say 6:30 AM, (cell, C3) it shows a total time, even if the other cells are empty. Is there a way to not calculate time until more then one cell is populated? It is to clock in and out, AM and PM. The formula is,
    =((IF(C3>D3,D3+1,D3)-C3)*24)+(IF(E3>F3,F3+1,F3)-E3)*24
    Can someone please help me with this, or is there a better way of doing it? Thanks!

    1. Just add some more nests to your formula to check if D3 and F3 are empty.
      =If(D3="","") will check D3 and if it is blank will make the cell with the formula in it blank as well. Build this check into your existing formula and you will get what you are after.

  13. Can any one help to find available cars in every 30 mins interval during 24 hrs schedule
    total fleet (cars) 180 , routes 28. Pax capacity 14. turn around duration 90 mins per trip.
    next day i need to generate report with actual transported and available buses to find shortage of cars in every 30 mins / 1 hrs.

  14. I have a schedule with start times and finish times.
    I made separate column for how many hours each day.
    How do I add these times up to find how many hours per week?
    From there I will need to make a separate sheet to calculate hours over 80 per pay period.
    I thought it would be something like this:
    =TEXT(R5:X5, "h:mm") but it isn't working

    1. Hi Beth
      you have made your result to be TEXT and you cannot calculate with text.
      Also when a result is more than 24 hours you have to be careful with formats otherwise Excel will not display what you are expecting. Use cell format "General" or "Number" but not time. If you use time everything goes back to zero after 23:59 like a clock.
      Apart from that, then calculate as normal =sum(R5:X5) or if you really want to =Sum(R5:X5,"[h]:mm") The bracket around the h tells excel to go beyond the 24 hour constraint it normally uses and you need that. Make sure R5 through to X5 are numbers not text as well and watch those formats, it can mess up your calculations big time.

  15. I have start time and total hours worked for the day. How can I get the end time?

    1. Hello Cindy,

      To find out the exact end time, just use the formula below:

      =A1+TIME(B1, 0, 0)

      Where A1 is the start time and B1 is the total hours to work.

      1. Hello Alexander, Im working on an overtime sheet. Where I need to calculate times between(16:00 to 21:59) & (22:00 to 07:59) in different columns

        1. Hello!
          I’m sorry but your task is not entirely clear to me.
          For me to be able to help you better, please describe your task in more detail. Please let me know in more detail what you were trying to find, what formula you used and what problem or error occurred. Give an example of the source data and the expected result. It’ll help me understand it better and find a solution for you. Thank you.

  16. i given one small example for this comment box
    K Column 8:30 to L Column 10:00 =IF(K3>L3,1+L3,L3)-K3
    M Column Result is 1:30
    But in the Same M Column I need time difference in Minute in the same Cell like 90 minute

    1. Change your formula to =(IF(K3>L3,1+L3,L3)-K3)x1440 and you will get your answer in minutes.

      1440 being the number of minutes in a day.

  17. Excellent information. Thanks a lot.

  18. The difference between Old time New time= +/-

  19. Hi, I'd like to count elapsed time but in the situation when dates and hours are in separate cells.
    A1=Start B1=2019-01-12 C1=6:00
    A2=End B2=2019-15-12 C2=20:40
    I'd like the result to be divided into full days (24h) and the remaining time.

  20. I need to make my work sheet for counting my flying hours. It's like that,

    350.45hrs - 150.25hrs = 200.20hrs

  21. Hello. I need assistance with writing a formula to calculate holiday hours for anytime worked before 5pm.
    for example:
    Time in is 11:46 am and Time out is 4:39
    or
    Time in is 2:00 pm and Time out is 12:00 AM

  22. how can calculate extra working hours and minute in amount
    As like-
    Report Time Out Time Total time Working Time/per Day Extra working Time Per hours *50 Rs Extra working Amount
    08:00 22:50 14:50 12:00 02:50 00:00 ??????

  23. How do I add 26 hours to a time if it has to calculate it by office hours say 9 - 19.

  24. Hello:
    If I have start time and end time in one cell, how can i get the toal # of hours. For example: in one cell I have: 05:00 pm - 10:00 pm. How can i get the total # of hours which is 5 hours?
    Thank you so much!

    1. Is the end time always on the same day as the start time?
      Total Hours = (End time - Start time) * 24
      For example -> C1 = (B1-A1)*24
      Where:
      A1 = Start time
      B1 = End time
      C1 = Total Hours
      Make sure the number format for the total hours cell is general or number.

  25. Nakul Neel Ajay Ghanshyam
    Date in Out in Out in Out in Out
    1-jun 11:00 16:00 10:00 19:00 10:00 19:00 10:00 15:30
    20:30 02:00 - - - - 19:20 02:00
    2-jun 10:00 16:00 10:00 16:00 14:30 02:30 10:00 16:00
    20:30 02:30 - - - - 20:30 02:30
    3-jun 10:00 16:00 10:00 19:00 15:00 02:00 10:00 14:30
    20:30 02:00 - - - - 19:40 02:00

    How to calculate night/day

  26. i am looking for the elegant way to calculate night and day power consumption. the problem is that night tariff is calculated from 23:00 to 7:00, and counter indications are not taken daily.
    e.g.
    26 October, 13:06
    28 October, 11:26
    4 November, 17:46
    how to calculate the time (hours and minutes) that can be attributed to the night/day time?

  27. Using the 12 hour format, I am struggling to calculate the duration of hours when the start time begins at PM and the out time ends at AM. For example, if I wanted to find the duration of hours from 12:30AM(A1) to 3PM(A2), I would use the formula =(A2-A1)*24, which is 14.5 hours. BUT this does not work if I were to calculate the duration from 3PM(A1) to 12:30AM(A2), which is 9.5 hours but formula =(A2-A1)*24 will give me -14.5. What formula would I use to find the difference of time from PM to AM?

    1. You can use the formula =(IF([@Start],[@End],[@End])-[@Start]) and write the end time as over the 24 mark rather than going back to 00:00:00. For example: start= 23:00:00, end= 25:00:00, and the duration it gives you will be 02:00:00.

      The formula provided by Mary also works! If you want the same formula for the whole collumn though, that's what I use.

  28. sdsf

  29. 1 hour to two hours and three minutes how much longer?

  30. I struggled, pls help me. I am using an updated version and this wouldn't work for me. Do you know why?

  31. Need to perform a calculation on an employee schedule (utilizing the 24 hour clock) where start time is 19:00 (A11) and end time is 03:00 (A12) and get an answer that is not in negative hours ( =SUM(A12-A11) currently returns -16). When I use the hours 16:30 (B11) and 23:30 (B12) that do not span midnight (2400) then the calculations are correct ( =SUM(B12-B11) currently returns 7:30), which I can easily convert to 7.5 hours, any suggestions without having to program the dates into the start times?

    1. Hi Woody,
      just add 24 hours if the time will be negative :
      =IF(A12<A11,A12-A11+24,A12-A11)
      expl : check if value A12 is less then A11; if so add 24 to the difference, else just use the difference.
      Think it will work for you.

      1. This worked.
        But when we SUM such results with SUM formula, it doesn't show the right value.

  32. Please give me a formula for total calculate...
    00:49
    02:08
    00:29
    -00:02
    01:55
    -01:36
    total=?

  33. There are multiple overlapping time line items e.g
    Renjee: Cell B 01:23 Cell C 02:23
    Renjee: Cell B 01: 40 Cell C 02:40
    Basically i need to figure out the exact time logged in i.e 01:23 - 02:40.
    Is there a way to work it in excel.

  34. hI,
    if I want to Calcutta the total working hours for an employee excluding break time. how I can do this? i.e. below
    DUTY IN 23:00
    BREAK OUT 0:30
    IN 1:00
    BREAK OUT 5:00
    IN 6:00
    LEFT 11:00
    act WORKING HRS-....
    Thanks

    1. Calculate In to Out time.
      In your case
      3 time periods
      Add all 3 of them.
      If all employees strictly use 2 breaks in his shift.

  35. I need to find the total in DAYS you get when you sum a column. My column is in hours.

  36. Hi,
    I need to be able to get the time worked from the start time, to the end time, 22:00 hrs start and 06:00hrs end.
    Terry

    1. Change the format in cells b2 and c2 to custom [h]:mm:ss
      =IF(C2>=B2,C2-B2,C2+1-B2)*24
      In cell B2 type in your start time
      In cell C2 type in your end time
      Copy and paste the top code in Cell D2

      1. Thank you So Much!

        You helped me a lot!

        1. OMG!!!! You just saved me so much time!! This formula worked PERFECTLY!!! THANK YOU!!!

  37. I would like to calculate elapse time how do I write a formualae to reflect that for e.g. start time 8:30 a.m. end time 7:40 p.m

    1. =SUM(C9-B9)-D9
      in C9 type your start time
      In B9 type in your end time
      Copy and paste the top line in cell D9

      1. Wouldn't that cause a circular reference?
        C9: 8:30
        B9: 19:30 (which baffles me to put the End time in B and Stat time in C...?)
        Then, in D9, we subtract those two AND subtract D9 itself from that?... ???

  38. (Stop time) - (Start time) = (IF =0, then add one minute to stop time);
    (08:00.50) - (08:00.10) = 0 (error)
    Thus, 08:01 -08:00.10 = 1 (acceptable)

    Query: how do you write the formulae reflecting this?

    Thank you

  39. I need to make a cell (minutes late) using 1 cell (Scheduled departure time) being subtracted from another cell (actual departure time). The trick is i need the time starting at 12:00 pm. Ex: Truck leaves at 12:15 am, but the Scheduled time is 11:45 pm. My current sheet shows 23:30 minutes late instead of 30 mins.

  40. Setting up a time sheet. I have worked out the formula for daily hours worked and a weekly total, what I cant work out is one for the following.
    total hours if greater than 37 or lesser than with a value in hours and minutes.
    I can get the correct figure if the total hours are greater than 37 using =D7-TIME(37,0,)but when it goes into a negative the result is hours, mins subtracted from 24.
    What do I need to do to the formula to just show negative hours,mins?????

  41. Hi, I need to calculate the difference in time. I have my D&C columns formatted as "Time", and am trying the formula =MINUTE(D2-C2), but it just gives me #VALUE. Are there any other settings I need to check?

    Here is what my data looks like in each column:
    09/05/2019 3:41 PM 09/05/2019 3:57 PM

  42. in excel i am only count between 3 cell time but when I am going to + more then 3 cell time then the value gose wrong ...

  43. Hi may I ask anyone the formula to add restdays on work schedule? Thanks

  44. I am trying to have a column which shows a "-" minus sign if two times produce a minus. ie. 00:00:50 & 00:00:48 = -00:02 or if the sum was 00:00:48 & 00:00:50 = (+)00:02 but using one sum not having to individually go through & tell the formula if the sum is a plus or minus result. The first timing is 50 secs & the second 48 secs then the result is -2 seconds, etc.

  45. You have a great series of Excel lessons here.

    I’m looking at the table right above the Formula 2 heading using the formula

    =$B2-$A2

    I noticed the calculations give incorrect totals.

    Using line 3 in the table the correct number of hours should be 7 and not 6.

    I can’t even figure out where the 44 minutes came from since 15 would be the quarter hour it should be 45 minutes. But really it should still be 15 minutes since we’re subtracting 15 minutes from nothing.

    And lastly 30 seconds from 40 seconds leaves 10 seconds, where does 50 come from?

    I’m trying to setup a time sheet if the form of:

    Date In Out In Out Total

    I know that my formula will be (Out1-In1)+(Out2-In2)=Total for the Day,
    But I can’t seem to get past the incorrect calculations.

    Is there some tid-bit of information that I’m missing or just not understanding?

    Any help would be greatly appreciated.

  46. Hi can someone help me with this formula, I am calculating time on excel with this formula but times are coming out as negative figures,
    =IF(C33="","", (C33-C32)*24- C34)

  47. Hello, I am trying to make a time sheet. Here is the example:
    Start time: 12:30 am
    Regular hours: 4.5 hours
    Extra hours: 40 minutes
    Break: 30 minutes if total hours more than 5 hours
    Finish Time: ??? I need the formula which should be 6:10 am as total hour more than 5.
    Total hours: 5.16 hours

    Thanks for your help.

  48. Thank you so very much for an excellent article.
    I haven't gotten my mind completely around it yet , but it certainly has me heading in the direction I need to go where as before I simply had no idea!

    Thanks again ....5 Stars

  49. I am trying to create a time sheet.
    There will be 2 different in and out columns. I want a sum of all hours worked.
    Example
    A2 B2 C2 D2 E2
    In Out In Out Total hours worked
    7:00 A 8:30 A 11:00 A 5:00 P

  50. I have an excel worksheet in which I'd like the date to update to the next date at a specific time. I have tried =today()+20/24, that only shows the current date and ten o clock in the evening. I am after it keep the previous data value (date) untill it passes a certain time value.
    Lets say its 5:59 AM the date it shows in the cell is previous days date. At 6:00 AM it changes to the current days date. Like first at 5:59 its 14th of june and then at 6:00 its 15th of june.

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