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 11. Total comments: 1023

  1. I need to figure out how can i get event time/run time of every account having multiple transactions, i need time duration between First till last transaction of every account, every account having multiple transactions count.

    1. All data is in one sheet, first column having account number, then amount then date time then type

  2. Hi there!

    I'm trying to track improvement in running times (e.g. how much faster someone is running 5km).
    So I was wondering if it is possible to subtract one running time (35 minutes 10 seconds) from a better running time (25 minutes 30 seconds) to see how much faster someone is running (-9 minutes 45 seconds).

    1. Hello!
      I hope you have studied the recommendations in the tutorial above. It contains answers to your question.
      Pay attention to the following paragraph of the article above: Formula 3. Count hours, minutes or seconds between two times.

  3. Hey I have a timesheet that I would like to calculate the specific hours given is counted as overtime 1 which is from 22:00 PM - 06:00 AM, time after 06:00 AM will be calculated as overtime 2. I wanna get the hours worked in oveRtime 1 is how many hours? is that possible.
    For example:
    TIME IN (A1) = 12:00AM
    TIME OUT (B1) = 11:00 AM
    hours worked in overtime 1 is 8 hours, and in overtime 2 is 5 hours.

  4. hey so i have a timesheet for work i need it to calculate total hours, overtime 1 and overtime 2
    where hours from 07:00-15:00 is normal hours so no overtime counted
    hours from 15:00-17:00 is counted in overtime 1
    and all other hours is counted in overtime 2
    like so
    if A1(start time)=07:00 B1(end time)=19:00 C1(total hours)=12 D1(overtime1)=2 E1(overtime2)=2
    or A1(start time)=04:00 B1(end time)=16:00 C1(total hours)=12 D1(overtime1)=1 E1(overtime2)=3

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

      =B1-A1

      =IF(AND(B1>TIME(15,0,0),B1<TIME(17,0,0)),B1-TIME(15,0,0),TIME(2,0,0))

      =IF(B1>TIME(17,0,0),B1-TIME(17,0,0),0)

      I hope it’ll be helpful.

  5. I need to calculate sub of two times Eg: 06:00-09:00 in 24HRS
    Ans should be in 24HRS Format
    I want to get 21:00
    Can you help Me?

  6. Hello.
    I'm looking for a formula. I made one that gives the total worked hours. But my problem is, let's say the office time starts at 8am, the formula includes the time over or under 8am which the minutes for late and early in is computed.

    1. Hello!
      If start time is greater than end time, then you need to add 1 day to their difference

      =IF(A1 > A2,A2-A1+1,A2-A1)

      I hope this will help

      1. Thank you for help works well

  7. I want to deduct time with a frame of more than 15 mins. For eg

    13.00pm
    13.01pm
    13.45pm

    Now it should skip the middle and select the next one. This type of format can be with more than 3 numbers

    1. Hello!
      I’m sorry but your task is not entirely clear to me. Could you please describe it in more detail? What result do you want to get?

  8. Hy. The formula works. I have the same schedule format. But how do I sum up with this formula for multiple days to get the final time number?

  9. I have 12:10 formatted as [hh]:mm in cell A1. How can I separate the hours and minutes so that the hours appear in A2 and the minutes appear in A3?

  10. How to get diff in days,hours,minutes,seconds,milli seconds for below
    Min time stamp: 2019-06-14 09:16:13.013
    Max time stamp: 2019-09-14 09:16:12.310

    1. Hello!
      Find the difference between these dates using normal subtraction. To determine the difference in time in days, hours, minutes and seconds, apply the formula to the cell with the result:

      =INT(A1)&" days "&INT(MOD(A1,INT(A1))*24)&" hours and "&MINUTE(A1)&" minutes, "&SECOND(A1)&" seconds"

      I hope my advice will help you solve your task.

      1. I need for milliseconds as well. Above works until seconds only.

        1. Hi Alexander Trifuntov (Ablebits.com Team),

          =INT(A1)&" days "&INT(MOD(A1,INT(A1))*24)&" hours and "&MINUTE(A1)&" minutes, "&SECOND(A1)&" seconds"

          Can you also add calculation for milliseconds as well in above?

  11. Need Excel formula for calculating the hours and minutes between to different AM and PM high tides. The two different AM (A1) and PM (B1) times could be different. The A2 could be a higher number then the B1 time number and vise versa. Need this formula for calculating this for each day of the year.

    1. Hello Robert!
      If the end time is longer than the start time, then you need to add 1 day to their difference

      =IF(A1 > A2,A2-A1+1,A2-A1)

      I hope this will help

  12. I am trying to create a spreadsheet to calculate labor pool hours in a spreadsheet when the employee is unable to clock in onsite and they are reporting IN and OUT punches. However, we use Kronos which rounds to quarter hours (example: if an employee clocks in at 8:07 am, it rounds back to 8:00 am but if they clock in at 8:08 am, it rounds forwards to 8:15 am.) If I were trying to add their IN and OUT punches to a spreadsheet and have a total time worked, is there a way to have it automatically take in to account the Quarter Rounding aspect of Kronos time to give them an accurate total time worked?

    1. Hello Amber!
      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. 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.

  13. I need help writting a formula that sums minutes between two specific times, for example start 9:10am - end 9:45am. I need to sum how many minutes were between 9:00am and 9:30am (20 min) and how many between 9:30 and 10:00am (15 min).

  14. I'm comparing timing for similar operations for recoding variables between R, SAS, Python and Excel. I need to calculate how long it takes, in seconds, to 3 decimal places (s.###), for a formula to calculate on an entire column in order to test the timing difference between two different formulas in Excel. Is there a way to do this? I would like to have a unique start/end time per column for when the refresh actually got to that specific column.
    e.g. for each column something like this? (untested):
    c1[=now()] d1[=now()] .... f1[=(d1-c1)*86400]
    c2[=a2*b2] ..... .... f2[=(e1-d1)*86400]
    c3[=a3*b3]
    .... ......
    Thank you for your time & reply!

  15. Hello!
    This may be simple, but I have been struggling with it. I have a report that puts out the time someone is on a call as 1:01:24 AM, when it is actually a period of time equaling 1 hour, 1 min, 24 seconds. No matter what format I put on the cell, I cannot seem to get it to change it over to the actual time period instead of the clock time of 1:01:24 AM. I am trying to do this as I would like to be able to take a list and add all of the times for the day. Can anyone help with this?

    1. Hello!
      I’m sorry but your task is not entirely clear to me. Could you please describe it in more detail?
      Write an example of the source data and the result you want to get.
      It’ll help me understand it better and find a solution for you.

  16. Hi, my roster is published with start & finish in the same cell. is there a way to tell the time difference between start & finish (I need an 11 hour break)?

    1. Hello!
      Please describe your problem in more detail.Include an example of the source data and the result you want to get. It’ll help me understand your request better and find a solution for you. Thank you.

    2. that should read betrween finish & start - between days

  17. Hello,

    If we are Summing times in a "total" cell, how do you include days? So far I managed the following:
    =SUM($D$2:$D$4)&" days, "
    this got me 39.7148.... days
    but it does not breakout down into days, hours, minutes, and seconds like the interval equation or the subtraction formatting did.
    If I manipulate the format and just sum the range, instead I get like 929 hours, 9 minutes, and 21 seconds instead of it breaking it down into days.
    What I want is for the total cell to show the total times added together as something like "38 days, 17 hours, 9 minutes, 21 seconds"

    1. Hello Samantha!
      To display the total amount of time in days, hours, and minutes, use the formula

      =INT(A1)&" days "&INT(MOD(A1,INT(A1))*24)&" hours and "&MINUTE(A1)&" minutes, "&SECOND(A1)&" seconds"

      I hope it’ll be helpful.

  18. Hello
    I want to calculate time elapsed between 2 dates and times h:m
    then i want the result in minutes rounded up to the hour if more than 50 min

    1. Hello!
      The following formula rounds the time to an hour if the number of minutes is more than 50:

      =IF(MINUTE(A1)>50,ROUND(A1*24/1,0)*(1/24),A1)

      I hope my advice will help you solve your task.

  19. Hi how do I calculate the difference in time of my end time is going to be in a different cell each time my start time will always be in B2 for example but my end time moves depending on the amount of tasks performed.

    1. hello Steven!
      The difference between the two dates can be calculated using the DATEDIF function. Read the instructions here.

  20. I have a list of dates and times and need to total the number of entries that have the same hours:minutes (within a date). I'm having trouble comparing as with different seconds the cells are different even if the view (HH:MM) is the same and comparing the difference doesn't work if one is 8:23:45 and the next is 8:24:12 is there a way to subtract the seconds so there is always comparable minutes? The list is in ascending order.

    1. Hello Steve!
      If your data is written in column F, then you can use the formula to count duplicate hours and minutes

      =SUMPRODUCT(--(HOUR($F$2:$F$6)=HOUR($F$2)), --(MINUTE($F$2:$F$6)=MINUTE($F$2)))

      and then copy it down along the column.
      You can read about finding duplicates here.

  21. I have a timesheet and I would like to have a calculation that subtracts the end time worked from the start time worked but have it subtract 30 minutes if it is over 6 hours elapsed and also subtract 30 additional minutes if it is over 8 hours elapsed. We have part time and full time staff. There are also some full time staff who work longer hours and get an hour for lunch instead of a half hour. I have tried to modify this:
    =IF(ISERR(O28-N28),N28,MOD(O28-N28,1)-(MOD(O28-N28,1)*24>6)/48)
    which subtracts the 30 minutes but does not account for the staff that stays longer and takes an hour lunch.
    I have this
    =TEXT(O28-N28, "h:mm")-("0:30")
    but it just assumes the calculation is over 8 hours and subtracts 30 minutes.
    I am stuck. Any help would be greatly appreciated.

    1. Hello Jennifer!
      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. What data do you want to use to change your formula? 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.

  22. Hi, I just want to simply be able to subtract times in order to get the number of hours worked. For example, in the first column is 10:00 AM (A1), in the second column is is 2:20 PM (B1). I tried doing =B1-A1 to get the total hours, but the resulting cell is showing me 4:20 AM. How do I convert this cell into an actual number of hours, and not formatted in that way?

    1. Go to the cell in question (the one that is showing you 4:20 AM) and then go to Number Format, scroll down to More Number Formats, (alternatively you can just right click, then click Format Cells), on the Number tab click TIME, under "Type" click 13:30. This will give you your answer in the format I think you want: 4:20 meaning 4 hours and 20 minutes worked.

  23. Mr. Trifuntov,
    I'm creating an excel file to manage the shifts of a restaurant and I'm having trouble to manage sums. The working shifts in most cases are divided in two (morning - evening). The columns represent the days of the week. For each worker / day I have four cells (morning (entry/exit) - evening (entry/exit). The problem arises when I don't include information in all the cells (because it is a day off/ the restaurant is close or the worker makes a continuous shift. The result in this case gives me as a result 00:00. When I want to calculate the total working hours during the week (sum) computes the 00:00 as 24 hours. What I can do to resolve this issue?.

    Many thanks in advance for your time, availability and expertise.

    1. Hello Xabier!
      To show time in a cell for more than 24 hours, set the time format to "37:30:55"
      For me to be able to help you better, please describe your task in more detail. Please specify 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.

  24. Dear sir I am having 80 customer around the world from - india how I can know the time of that cotumer to whome I want to talk, I know if my cutomer is in Totanto a time is GMT -5.30 and Totanto time is -4 how I will calculate in excel. Sheet. And same with other customers.please explain

  25. I want a formula for vehichle down time. The vehicle duty time is 08:am to 07:59pm. Then the vehicle down for continuous 3 days( 4th may 2020 11:35 am to 7th may 2020 06:20 pm). Then how many hours and minutes down in per day calculation.

    1. Hello!
      If the first date is written in cell A1, and the second in cell A2, then the formula
      =(A2-A1)/number_of_days
      Set the time format to "37:30:55" in the cell with the formula

  26. Hi Alex, I need to calculate the hours between two dates but excluding the holidays or weekends.Please help

  27. Hi Alexander,
    May i know what formula do i use if i want the leftover number of minutes (don't need hours) for the below scenario and what format should i set it to?

    START BREAK TIME: 13:15 (IN 24HOURS)
    END BREAK TIME: 13:30
    TOTAL TAKEN: 0:15 (MINUTES)
    LEFTOVER NUMBER OF MINUTES (IF I'M GIVEN 30MIN OF BREAK TIME): ?

    Thanks in advance :)

    1. Hello!
      To subtract time in Excel, use the usual subtraction formula =A2-A1
      You can use other methods of calculating the time difference, which are indicated in the instructions above.
      Please go to Format Cells, choose Number -> Custom Format and set
      mm:ss
      In this case, the number of minutes will not exceed 60

    2. in another words, i have recorded the break time used which is 0:15 minutes after subtracting a time from another time. i need a formula to show how much time is left if break time is given for 30 min.

      thanks again!

  28. Looking to calualte the duration between today's date and the date something was entered into my system

    i.e. created date 06/01/2019 -looking for length of time between whatever inputted date verus todays date, can some one help with the formula please?

  29. Trying to subtract one time from another ... including milliseconds and microseconds.
    Format is HH:MM:SS.mmm µµµ
    Example: 15:57:53.529 016 - 15:57:52.896 516 = 0.6325
    Any help would be most greatly 'preciated!

    1. If the time difference is negative, add 1 day (24 hours)

      =IF(B3 > B1,B1-B3+1,B1-B3)

      To the start time you need to add 1 day.
      I hope it’ll be helpful.

  30. hello. suppose i want to calculate OT hrs where staff sign in time is 9:00am and signout time is 3:00 pm. total working hrs is 6. after deducting 4 hrs which is compulsary to work, how could i find the exact time when OT starts? what will be the formula.
    thank you for the help in advance

    1. Hello!
      If A1 is the start time, B1 is the end time, then OT in cell C1

      =B1-A1-TIME(4,0,0)

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

      1. Sir

        the start time and end time in single cell how to calculate. i.e.
        07:00-19:00
        22:00-2:00
        i need to reduce 1 hr. where working hors are more then 8 and 30 min where working hours are less then 8.

  31. I am trying to figure out how to subtract time in excel. For example, I have to complete 250 hours of course work this summer. I am wanting to subtract the total hours I currently have from 250 hours, to come up with the number of hours I have remaining. I have 13:45 hours right now and can't seem to get the formula right to subtract that from 250 hours.
    Any help would be much appreciated!

    1. Hello Erin!
      To record time in a cell more than 24:00:00, use the time format "37:30:55". Next apply regular subtraction
      =B1-A1
      I hope this will help, otherwise please do not hesitate to contact me anytime.

  32. I'm racking my brain trying to figure this one out. I'm running a compliance audit whereby I need to work out how much time is worked before 6 AM and how much time is worked after. In other words, if my candidate worked from 1 AM to 9 AM, I need to be able to return a result that tells me 5 hours were worked before 6 AM. Any help is warmly appreciated.

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

      =IF(A7 > TIME(6,0,0),TIME(6,0,0)-A7+1, TIME(6,0,0)-A7)

      I hope this will help

  33. I want to substract 8:00hrs in cell 1 from 4:00hrs in cell2 and also if cell 2 value is 9:00hrs so result should be zero.
    Please help with query.

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

      =IF(M2 <> TIME(9,0,0),IF(M2 < M1,M2-M1+1,M2-M1),0)

      Hope this is what you need.

  34. Hi, I want to calculate the elapsed time students attended my class online. The report shows the time in a format like this:
    2020-05-12 15:41:08
    When I subtract the value of the two cells, I give #VALUE! error. I need the results in h:mm format. I appreciate it if you could help me with a solution.

    1. Hello Alireza!
      Most likely, you have a non-printable character in front of the date. You cannot see him. This often happens when importing data from other programs into Excel.
      Try using the CLEAN function:

      = CLEAN(C2) -CLEAN(B2)

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

      1. Dear Alex!
        Thanks for the quick reply. Unfortunately, it doesn't solve the problem. The same #VALUE! error exists.

  35. Hello! I need to calculate the time between 05-05-2020, 07:16:58 and 05-05-2020, 07:17:02. This is how it is populated on a report I download. I have tried =C11-B11 as a suggestion and also =TEXT(C11-B11,"d:h:mm:ss"), but I think the comma after date is causing issues.

    1. Hello Sheree L!
      The formula below will do the trick for you:

      =DATEVALUE(SUBSTITUTE(B1,",",""))+TIMEVALUE(SUBSTITUTE(B1,",","")) - DATEVALUE(SUBSTITUTE(A1,",",""))-TIMEVALUE(SUBSTITUTE(A1,",",""))

      or

      =SUBSTITUTE(B2,",","")-SUBSTITUTE(A1,",","")

      Remember to set the time format in this cell.
      I hope it’ll be helpful.

  36. Hi,
    I have issue where I am entering time as text as we want to enter 9:00am in it's simplest form as 900 but have set format to 00":"00 which works well until you do calcualtions and sum totals.
    I have a spreadsheet with 2 examples on it but not sure if I can send to you:-
    !) entering time as text
    2) entering time as time
    both have there issues. We need to enter start time, end time then set a default for 30 min break which can be over typed with longer break (or if less than 5 hours worked no break) and sum the days paid hours.
    Hope you are able to give me some guideance on this.
    thanks, Chris

    1. hello Chris!
      I'm sorry, it is not very clear what result you want to get. If you enter the number 900 in a cell, then you can convert it to time in another cell. Regardless of the format, a number, not time, will remain in this cell. Could you please describe your task in more detail and send us a small sample workbook with the source data and expected result to support@ablebits.com? Please shorten your tables to 10-20 rows/columns and include the link to your blog comment.

  37. In A1 i have a start time as 21:30:00 and in A2 an end time of 08:55:00 and have the formula of =IF(A2<A1,A1-A2+24,A2-A1)in A3; however A3 calculates as 12:35. Cells A1 and A2 set to [h]:mm:ss. Cells in A3 set to h:mm. I need A3 to calculate the actual time between 21:30 the previous evening to 08:55 the next morning in h:mm as the time of travel is through the night.

    Thanks.

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

      =IF(A1 > A2,A2-A1+1,A2-A1)

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

    2. Note: A3 should calculate to 11:25 (11 hours and 25 minutes) elapsed time since commecing at 21:30:00, but calculates AS 12:35 (12 hours and 35 minutes).
      Thanks for your support.

  38. Hi
    I have made a simple work schedule to show when each colleagues shift will be.
    I have a single cell displaying their start and end time (eg 10:00-14:00).
    the next column is for the number of hours in their shift.
    Is there a way I can get it to work out the number of hours in the shift automatically, or would I have to have a start and finish time in separate columns.
    I use the same sheet to print and put on the notice board so need it reader friendly.

    thanks!

    1. Hello Louise!
      Of course, it’s better to record the start time and end time in two different columns. But in your case, you can use the following formula:

      =TIMEVALUE(MID(A10,FIND("-",A10,1)+1, LEN(A10)-FIND("-",A10,1))) - TIMEVALUE(LEFT(A10,FIND("-",A10,1)-1))

      Remember to apply the time format to the cell with this formula.
      I hope it’ll be helpful.

      1. Hy. The formula works. I have the same schedule format. But how do I sum up with this formula for multiple days to get the final time number?

        1. Hello!
          You need to find the sum of the cells and the original time (12:10, etc.). Use the guidelines from the "How to sum over 24 hours in Excel" section above.
          I hope this will help

  39. How do you calculate the difference of day and time between days into minutes in one cell?

    for example:
    I have a email that came in last night at 8:30pm and i answered to the email at 10:30am the next day. How many minutes is in between of my response time?

    Also if it was during the weekend days how would it calculate the time?

    1. Hello Roxy!
      I recommend reading the first part of the above article, 'How to calculate time difference in Excel', to answer your question.
      To be able to show more than 24 hours in a cell, please use this time format: "37:30:55". You can find it in the list of Excel time formats.

      If Saturday and Sunday are traditionally considered to be days off, it is possible to exclude those 2 days from calculations with the help of this formula:

      =IF(WEEKDAY(A3) < WEEKDAY(A2),A3-A2-2,0)

  40. I do have two columns with date and time. I want to calculate the difference between them (so, that is pretty easy, only subtract). My issue: 1. End date sometimes is "Null" - in that case I tried to solve by adding if and setting the difference time to 999 or so. 2. I would like output to be in Days, Hours, Minutes, but days shown only if they are >0; and I want result still be a number (for the graph later). Original fields are in format yyy-mm-dd hh:ss. Is there a way to display this? I believe it is possible to do with IF by putting "" if month value is 0, but won't that put the result to text field format? Also, that is pretty lengthy formula, maybe there is a function or format that I am not aware of?

    1. Hello!
      If I understand your task correctly, please go to Format Cells, choose Number -> Custom Format and set
      [>1]m"m." d"d." hh:mm:ss;[<=1] hh:mm:ss;@

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

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

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

  43. do im doing something wrong :(

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

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

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

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

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

  49. 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))

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

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