Comments on: Calculating time in Google Sheets: subtract, sum and extract date and time units

It's time to talk about the ways of calculating time in Google Sheets. We'll discuss the ways of finding time difference in detail, see how to sum dates and time together, and learn to display only date or time units and set them apart completely. Continue reading

Comments page 3. Total comments: 393

  1. Hi Natalia,

    I am subtracting the hours accumulated for vacation time remaining. I'm trying to figure out how many days left in my vacation time.
    If I have 72 vacation hours (H3) and have used 3 hours (H4), 3 hours (H5) and 24 hours (H6) and now have 42 hours (H11=H3-H4-H5-H6-H7-H9-H10) remaining, how do I calculate or how do I format cell H12 to reflect the remaining days left if I work 3.5 days/ week (7.5 hours each)?

    Hope this is clear.

    Thank you!

    1. Hi fabio,

      If I understand your task correctly, you can use this function:
      =(H11*24)/7.5

      Multiply H11 by 24 to return hours as a decimal first. Then divide it by the number of hours you work daily. I've got 5.60 days.

      If this is not exactly what you need, please specify what the result should be and elaborate on the last part of your task: "reflect the remaining days left if I work 3.5 days/ week (7.5 hours each)"

  2. Hi Natalia,

    I am currently tracking my task durations in google sheets, which I then add up (or subtract) to calculate the total time duration in the same column.

    I am currently using the format : Elapsed hours (1) h: Minute (1) m
    The end result is as expected, for e.g : 0h:30m , 5h:0m etc

    Is there a way to hide the hours (h) or minutes (m) if they are 0?
    So from the example above, I'd like it to display as 30m and 5h only.
    What would be the right format to use to achieve this?

    1. Hi Drake,

      If you set up the format using the Google Sheets number format, it's going to show minutes/hours even if they're zero units.
      To hide zero values, I believe you need to incorporate the IF function & check if the result has 0 minutes or 0 hours. Then return the result in the required format set up by the TEXT function in the formula itself.

  3. Thanks for the post above on calculating times. I'm struggling to calculate negative times.

    I have a spreadsheet that calculates the duration of a shift from the start and finish time.

    What I'm trying to achieve is a formula that works out the difference,negative or positive, between a standard 8hr shift.

    Any ideas?

    Thanks

    James

    1. Hello James,

      Could you please describe the problems you've faced with negative times in detail?

      Or consider sharing an editable copy of your spreadsheet with us (support@apps4gs.com) with 2 sheets: 1) your sample data with formulas you tried, 2) the result you expect to get. Please shorten the tables to 10-20 rows. If you have confidential information there, you can replace it with some irrelevant data, just keep the format.
      Note. We keep that Google account for file sharing only and don't monitor its Inbox. Please do not email there. Once you share the file, just confirm by replying to this comment.

      I'll look into it and try to help.

  4. I have a self-made tool to keep track of my work hours, now I want to have it calculate the number of hours over 40.

    I'm using the Time hours:min:sec format for the time cells.

  5. Hello,
    Is there a formula for adding time im a single cell? So if i had 9-5 in a cell, could a formula add the 9-5 to equal 8 in another cell? Im tying to make a schedule using this format oppose to the duration method.
    Thanks in advance.

  6. no TIME function found, this is old

  7. Thank you soooo much for this info. Super helpful and easy to understand.

  8. Thank you very much! Really appreciated!

  9. How can this be applied to a start time before midnight and a end time after midnight? like working an overnight shift?

    1. Hello Jason,

      If you're trying to get the time duration, just make sure to add dates to the time units as well so Google Sheets calculates everything correctly.

  10. I've been looking EVERYWHERE for these simple formulas! Thank you.

  11. Hi Natalia,
    Can you please provide me formula in which I can calculate total hours they picked & packed in a day less the breaks they had. And also if they start for example picking around 2:00pm and they finished the next day around 11:AM. Our working hours starts at 10:00 am until 7:00 pm only. I hope you can help. Thanks.

    1. Hi Ghanshyam jangir,

      For me to be able to help you better, please share a small sample spreadsheet with us (support@apps4gs.com) with your sample data and the result you expect to get. Please include your start/end time units and the breaks (or how you indicate them). I kindly ask you to shorten the table to 10-20 rows.

      I'll look into your task and try to help.

  12. Great place to know more about advanced excel tricks and tips

    I have a question let's suppose I want to add 2 hours to the time and date format columns and also want the date to change were adding 2 hours in the 24-hour clock make it the next day

    example

    Column A = Date + Time (02.11.2021 00:00:00)

    Now by adding 2 hours in the above case date needs to be (03.11.2021 02:00:00)

    1. Hello Amin,

      I'm afraid the Google Sheets way of calculating this differs from your desired result. Since 02/11/2021 00:00:00 is midnight (the very beginning of 02/11/2021), adding 2 hours will result in 02/11/2021 02:00:00.
      You need to have 02/11/2021 23:59:59 in order to switch to the next day with the calculation. Or simply add 26 hours instead: =A2+(26/24)

  13. JJLIVERPOOL28 if you have anything to help help you help or help help me get

  14. Hi Natalia, Can you please provide me simple formula in which I can calculate total hours they picked & packed in a day less the breaks they had. And also if they start for example picking around 2:00pm and they finished the next day around 11:AM. Our working hours starts at 7:30am until 4:00pm only. I hope you can help. Thanks.

    1. Hi Cristine,

      I'm sorry, I'm afraid these pieces of info are not enough to give you a formula. What about the breaks? Are they indicated in your document as well? Can they also start one day and end the next day?

      For me to be able to help you better, please consider sharing a small sample spreadsheet with us (support@apps4gs.com) with 2 sheets: (1) a copy of your source data (2) the result you expect to get. I kindly ask you to shorten the tables to 10-20 rows.
      Note. We keep that Google account for file sharing only and don't monitor its Inbox. Please do not email there. Once you share the file, just confirm by replying to this comment.

  15. Hi,

    I am trying to put a sheet that works out how many hours a team member has worked between 08:30 - 17:30 (weekdays) and how many hours they have worked outside of this on a shift (all day at weekends). The shifts can finish at any time including after midnight. I have tried multiple formulas with no success.

    The cells that require attention are B27 to B36

    The starting information is:

    B27 = TIME(08,30,0) {start of in hour timeframe - fixed time}
    B28 = TIME(17,30,0) {end of in hour timeframe - fixed time}
    B29 = 00:00 {start time of shift - variable field}
    B30 = F8+B29 {end time of shift - fixed value, F8 takes total shift time from another cell}

    B32 = =IF((B30-F8)>TIME(6,30,0),TIME(6,30,0),"")
    B33 = =IF(B30>TIME(17,30,0),IF(B30<TIME(23,59,59),B30-TIME(17,30,0),B32),0)

    The most recent attempt at making this work came out as this:

    B35 {out of hours worked} -

    =(IF(B291,B30-1,0))-(if((if((B29+F8)>1,B30-1,0))>TIME(8,30,0),(if((B29+F8)>1,B30-1,0))-TIME(8,30,0),0)))+B33

    B36 {in hours worked} -

    =F8-B35

    I have sent a copy of the template to yourselves (named "Work in progress"). I am aware that these calculations do not even begin to factor in the weekend shifts but wanted to establish the timings before moving onto when the date of the shift occurs.

    Thank you for your guidance.

    1. My apologies,

      The formula in B35 is actually this:

      =(IF(B291,B30-1,0))-(if((if((B29+F8)>1,B30-1,0))>TIME(8,30,0),(if((B29+F8)>1,B30-1,0))-TIME(8,30,0),0)))+B33

      1. Hi Adam,

        Thank you for sharing your spreadsheet and for the detailed description.

        I'm afraid there are some moments that I don't understand in your tables. E.g. what those 6:30 hours mean in B32 and whether you'd like to take them into account for calculations as well. I'm also not sure what 'total premium time on shift' should contain. Is it different from B33?

        I've adjusted your formula in B33 (my variant is in C33) as it looks like your formula contains odd 10 minutes.

        For now, based on what I was able to understand, I would suggest to try using the following logic (see very simple demo cells on Sheet2):

        1. calculate the total time spent for the journey: shift + overtime
        2. check if the hours spent for the journey overlap with any shift hours
        3. subtract that overlap from the total time spent for the ride. This way, you will get the total overtime hours
  16. How do. You subtract minutes from time?

  17. Hi Natalia,

    I'm currently creating a work schedule for my new work place and im trying to convert induvial hours logged over 24hrs in one section into reading like a 24 hour clock in the another section of the schedule (eg 10.00 - 18.00) or if the person was off (libre) then "libre" would show up. Do you know if this is possible.

    Thanks !

    1. Hi Conor,

      please consider sharing an editable copy of your spreadsheet with us (support@apps4gs.com) with 2 sheets: (1) your source data, (2) the result you expect to get. Please also shorten the tables to 10-20 rows.

      Note. We keep that Google account for file sharing only and don’t monitor its Inbox. Please do not email there. Once you share the file, just confirm by replying to this comment.

      If you have confidential information there, you can replace it with some irrelevant data, just keep the format. I’ll look into it and try to help.

  18. Hi im trying to do Operators Efficency Sheet in Google Spreed Sheets i'v done most of it but hit dead end 2 weeks now
    so the problem is on my sheet. differnce103800 in own column and in diffrent column i'v divied 200 gives me 519 and in diffrent column it's give me 8.65 it's not what im looking for im looking for 08:39:00 which is correct answer i'v tried everything can you help
    please

    1. Hi Matthew,

      For me to be able to help you better, please share an editable copy of your spreadsheet with us (support@apps4gs.com) with 2 sheets: (1) a copy of your source data (2) the result you expect to get. I kindly ask you to shorten the tables to 10-20 rows.

      Note. We keep that Google account for file sharing only and don't monitor its Inbox. Please do not email there. Once you share the file, just confirm by replying to this comment.

      I'll look into it and try to help.

  19. Hi I was wondering if there is a formula that can calculate the number of minutes after a specific time. I need total number of minutes after 3pm. Thank you!

    1. Hi Kim,

      Assuming your start time (3pm) is in A2, here's the formula to try:
      =HOUR(NOW()-(TODAY()+A2))*60 + MINUTE(NOW()-(TODAY()+A2)) + SECOND(NOW()-(TODAY()+A2))/60

      Make sure to format a cell with this formula as a number.

  20. Hi there! I want to make a column that updates with a new number displayed every 6 hours. For example, it starts with 2, and after 6 hours have passed it displays 4 instead of 2. How would I go about this?

  21. Hi! My hope is that there is a sum formula for adding song lengths that contain hours, minutes, and seconds. I have them set up in this format: 01:04:35 but it doesn't add it as hours, minutes, and seconds... Is there a formula? Do I need to put each quantity in separate cells? hours in one, minutes in one, and seconds in another? thanks!!!!!

  22. Is there a way when subtracting time to automatically convert time format of minutes to hours as my goal is like this:

    On A1 is start time say 8:00 AM and on A2 is end time as 8:40AM, and it returns the duration on A3 as "40 mins".

    What I aim is that if it's more than 60 mins, say A1 is 8:00AM and A2 is 9:20AM, it automatically formats A3 result to "1 hr 20 mins"

    1. Hello John,

      Try this formula:
      =IF(MINUTE(A2-A1)>60, (HOUR(A2-A1)&" hours, "&MINUTE(A2-A1)&" minutes"), A2-A1)

  23. i have to convert data in 3-3 hours conversion ex- if one message is popup on 12:00am then display 12:00am to 3:00am time slot, other message is came on 7:00pm then display 6:00pm to 9:00pm time slot

  24. Please could you help with the following? I am not sure what kind of formula should be used. I wanted to make use of a screenshot of an example of what I want, but it won't allow me to paste a screenshot.

    I need to set up a program for a dancing competition. I have different sections in the dancing competition, with each section have different time limits per performer. So here is an example:

    Section: Solo Start time: 9:00 AM

    Competitor 1 (Maximum time: 3min:30sec) (Grace time: 2min)
    Competitor 2 (Maximum time: 3min:30sec) (Grace time: 2min)
    Competitor 3 (Maximum time: 3min:30sec) (Grace time: 2min)
    Competitor 4 (Maximum time: 3min:30sec) (Grace time: 2min)
    Competitor 5 (Maximum time: 3min:30sec) (Grace time: 2min)
    (Grace time after each section: 2min)

    End time: ?

    Section: Improvisation Start time: SAME AS END TIME - ?

    Competitor 1 (Maximum time: 2min:0sec) (Grace time: 1min)
    Competitor 2 (Maximum time: 2min:0sec) (Grace time: 1min)
    Competitor 3 (Maximum time: 2min:0sec) (Grace time: 1min)

    So I want the condition to be, if it is a solo, then maximum time per competitor is 3min:30sec with 2min grace for each competitor, with 2min grace after section. Start time is 9AM, so what will the end time be after section has ended?

    Hope the above example makes sense.
    Thanks in advance

    1. Hello Antoinette,

      Feel free to share an editable copy of your spreadsheet with us (support@apps4gs.com) with 2 sheets: (1) a copy of your source data (2) the result you expect to get. I kindly ask you to shorten the tables to 10-20 rows. I'll look into it.

      Note. We keep that Google account for file sharing only and don't monitor its Inbox. Please do not email there. Once you share the file, just confirm by replying to this comment.

      1. Thanks so much Natalia. I have shared an editable sheet. It is just an example, as I cannot send the original sheet, because in our country there are laws against sharing people's information (especially children). I hope it makes sense. I do know what I want is quite complicated.

        1. Thank you for sharing your spreadsheet, Antoinette.

          I created a new sheet – Copy of the Result – and entered all formulas there. I use the IF function to return the times per competitors based on the section mentioned in A2. You can add more conditions for other sections with the help of nested IF or IFS to reuse the same formula for other sections as well.

          The total duration is a simple sum of all those time units.

          Hope this helps! Please let me know if this is what you need :)

          1. Thanks so much for your help.
            I was trying to make it very complicated, and it actually is not.
            This really helped a lot.

            Hope you enjoy your day.

  25. Hey Natalia, hope you are well,

    Just making sure you got my message on (May 20, 2022 at 5:14 pm)

    1. Hi Jordan,

      Sorry I couldn't reply earlier. I replied a few minutes back though, please see my comment below.

      If you still need some help with your formulas, please consider checking out the blog post we wrote about the IF function. Or share your spreadsheet with us (support@apps4gs.com) with 2 sheets: (1) a copy of your source data (2) the result you expect to get. Please shorten the tables to 10-20 rows.

      Note. We keep that Google account for file sharing only and don't monitor its Inbox. Please do not email there. Once you share the file, just confirm by replying to this comment.

      1. Hi Natalia,

        I have invited you to my Google Sheets for you, i think it would be the best way to figure it out.

        1. Hi Jordan,

          Thank you for sharing the file. Seeing the whole picture, we've come up with another solution. I entered the formulas on the Copy sheet, please take a look.

  26. Hi Natalia,

    I have been reading through your blog posts and they are really tremendous. Need your support on one of my on-going problems which I am trying to solve through formula in Google-Sheets :

    1. end_date = Available = (Today())
    2. Number of months = Available in decimal = (4.1) months
    3. start_date = ? (how to compute it)

    Your help in this would be much appreciated.

    Best,
    Deep

    1. Hi Deep,

      I'm sorry, I'm afraid I don't fully understand your task. Is that number of months shows the duration from the start time?

  27. if I want to use =TEXT(B2-A2,"h:mm") to subtract time but I want it to display the result as 3h 2m how do I format it to do display it as such?

    1. I ended up figuring it out after days of trying things it was super easy. This is for anyone interested.

      Times:
      D2 - 5:18:00 PM
      E2 - 8:20:00 PM

      =HOUR(E2-D2) & "h " & MINUTE(E2-D2) & "m"

      Result - 3h 2m

      1. Hi Victor,

        Sorry I couldn't reply to you earlier. Happy to see you've got it figured out :) Thanks for sharing your solution!

        1. I ran into an issue today where it won't subtract backwards times like pm to am. Such as

          12:23 AM - 9:50 PM

          It gives an error because it's a negative number and I still haven't found a workaround

          1. Hi Victor,

            The result I'm getting with this set of times is 21h 27m.

            For me to be able to assist you better, please share a small sample spreadsheet with us (support@apps4gs.com) with 2 sheets: (1) a copy of your source data with the formulas that don't work (2) the result you expect to get. I kindly ask you to shorten the tables to 10-20 rows.

            Note. We keep that Google account for file sharing only and don't monitor its Inbox. Please do not email there. Once you share the file, just confirm by replying to this comment.

            1. Yes but that result is backwards and not correct. 12:23 Am is right after midnight. If you subtract midnight to 9PM that is only 3 hours we are trying to subtract not add.

              I'm building a sheet to track all of my forex trading. I want to enter the time I start a trade and the time I end a trade and it tell me how long that trade went for. So I can keep an idea on how long these trades are lasting. Yesterday I started a trade at 9:50 PM and it went until 12:23 AM which is right after midnight. So I need it to subtract the time.

              The result I'm looking for is 2h 33m

              1. Can you give me a sample sheet that I can take a look at. I'm currently using two cells to collect this data. One for just the date and one for just the time.

                4 cells total. Date, Time Start, Time End, Time completed

              2. Hello Victor,

                If you'd like to take a look at how the formats work, you will still need to go to the Format settings to see the difference. So you can just literally (1) enter 9:50 PM into one cell and both, time & date, e.g. 06/02/2022 9:00 PM, in another, (2) select both these cells, (3) and go to Format > Number a few times and try to apply different formats, including those with the date unit. You'll instantly see what I mean about the dates.

                For me to be able to help you better, I kindly ask you to share your sample sheet with us: support@apps4gs.com. You don't need to provide your entire document. A sheet with a few rows showing your source data and a sheet with the result you expect to get is more than enough. Thank you.

              3. Thank you for the update, Victor.

                If you enter time without a date, Google Sheets treats these times as from the same day. You can check that by changing the format to Date time.
                So I'd advise you to enter both date and time to your cells (just set the format as Time to keep the date hidden) and you should get the correct results.

  28. We need formula for if working hours is 6 and 1 person working 6.5 hours and we need to show he worked 0.5 hour extra (fixed time 10:00AM to 04:00PM) (Work time 10:00 AM to 4:30:00PM) actual extra work 0.5 hour

    what is the formula for that

  29. Hello Natalia,

    I use google sheets to do wages and I need a bit of help to sort an issue.

    Regular work hours are 9am to 6pm (important to remember) and I'm trying to subtract overtime hours or minutes that my employees work.

    For example, Start time is (7am) and the finish time is (9pm), I'd then like it to separate in another cell the 2 overtime hours from the starting point (7am-9am) and the 3 overtime hours from the finish point (6pm-9pm)

    Look forward to hearing back from you.

    1. Hello Jordan,

      Assuming your start time is in A2 and end time is in B2, try these IF formulas in C2 and D2:

      • for C2:
        =IFS(OR(A2<TIME(9,0,0),A2>TIME(9,0,0)),TIME(9,0,0)-A2,A2=TIME(9,0,0),"")
      • for D2:
        =IFS(OR(B2>TIME(18,0,0),B2<TIME(18,0,0)),B2-TIME(18,0,0),B2=TIME(18,0,0),"")
      1. Hey Natalia, thank you for getting back to me.

        So far the C2 format is working and I'm assuming that you missed out a comma in this area [A2TIME] but I have replaced it with [A2,TIME] and it's working.

        For the D2 format, I am getting an error message, see the error message below.
        [Wrong number of arguments to IFS. Expected at least 2 arguments, but received 1 arguments.]

        1. Hi Jordan,

          My apologies, the formulas appeared broken due to > and < symbols. I've edited the formulas, please take a look now.

        2. I have also just noticed, that when I add the start time 10am. In C2 I get [23:00:00]. Is there any way to make it 00:00:00 if the start time was anytime after 9am?

          1. At the moment, the formulas calculate the negative number if the start time is after 9am. But if you'd rather see 00:00:00, then you need to write out each condition and the required result in the formula:
            =IFS(A2<TIME(9,0,0),TIME(9,0,0)-A2,A2=TIME(9,0,0),"",A2>TIME(9,0,0),TIME(0,0,0))

            1. Hiya Natalia,

              I'm not sure what I even wrote in the last reply, I'm confused myself lol.

              So at the moment with the new [FORMAT] you provided, whenever I type anything after 9am it says 00:00:00 which is correct and id now like another format to do the same for when I write a time that is before 18:00:00 it should say 00:00:00 and it would only count the time after 18:00:00.

              [FORMAT] you provided earlier:
              =IFS(A2TIME(9,0,0),TIME(0,0,0))

              Another note, not a huge issue, so when using the [FORMAT] and typing a time for example 10:00:00, it says 00:00:00. Is it possible to just have it blank using the '' ''?

              1. I am trying to type the format you sent me on (May 19, 2022 at 6:49 am) Spain time.

              2. Hi Jordan,

                For when the time is before 18, the drill is the same: you need to put that as a pair of "condition, it result" in the formula. Just like I did with 9, but only with 18 this time:
                =IFS(A2<TIME(18,0,0),TIME(0,0,0),...)

                If you prefer empty cells rather than 00:00, yes, feel free to use "" instead.
                =IFS(A2<TIME(18,0,0),TIME(0,0,0),...)

                Btw, I still suggest you look through this blog post about the IF function :) You just may find the answers to your questions there much faster than I can reply :)

              3. Its done it again, let me try another font:
                [=̶I̶F̶S̶(̶A̶2̶̶T̶I̶M̶E̶(̶9̶,̶0̶,̶0̶)̶,̶T̶I̶M̶E̶(̶0̶,̶0̶,̶0̶)̶)̶]

              4. I can see the confusion now, I'm trying to type the full [FORMAT] in the reply but for some reason it changed and doesn't post the hole thing?

                Hopefully this works, this is what I'm trying to type:
                =???(??????(?,?,?),????(?,?,?))

            2. Thank you ever so much for the help you have provided so far.

              This format:
              =IFS(A2TIME(9,0,0),TIME(0,0,0))

              What would the format be for a time before 6pm?

              1. You're most welcome, Jordan :)

                As for time before 6pm – if you'd like to add a condition for when the start time is before 6, just add the same part you quoted to the formula but change 9 to 6. If you mean you'd like to add conditions for the end time as well, please specify what you'd like to return if it's before/after/equals 6.

  30. I typed a start time colum and an end time colum via the 13:25 format (the date is on a separate colum): I don't understand how to calculate the subtraction : meaning the differnce between them.
    How can I do that please?

  31. Hello - trying to get google sheets to auto calculate clock out time for me - IE i put in / out time in for monday- thursday, and only in time on friday. Id like google to do the math for the final clock out, except it giving me negative total hours and the rest of the numbers dont seem to jive....

    1. Hello Vernon,

      For me to be able to help you, please share an editable copy of your spreadsheet along with your formula with us: support@apps4gs.com. I'll look into it.

      Note. We keep that Google account for file sharing only and don't monitor its Inbox. Please do not email there. Once you share the file, just confirm by replying to this comment.

      1. sent the link via gmail

        1. Thank you for the example, Vernon.

          Your formula doesn't work because you use 40 as an integer, not as a number of hours. I've entered the correct formula to F6:
          =B6+(TIME(40,0,0)-SUM(D2,D3,D4,D5))

  32. I have a number which is 16.80
    so since there is no 0.80 in minutes, it has to be converted to 0.70+0.20 so time becomes 17.20
    Want to represent the time as 17.20
    How do I do this

  33. I'm having an issue where the formula =(f2-e2,"h:mm") is returning times that are off by a minute. For example cell e2 is 01:18 and cell f2 is 03:38. The above formula completes as 02:19 when it should be 02:20. This is happening on a significant portion of data I am trying to create.

    1. Hello Jason,

      You formula doesn't work on my side at all (formula parse error). However a simple =F2-E2 returns 02:20.
      For me to be able to help you, please share an editable copy of your spreadsheet with the formula that returns 02:19 with me: support@apps4gs.com. I'll look into it.

  34. =E10-D10+G10-F10+I10-H10+K10-J10+M10-L10+O10-N10+Q10-P10

    I am trying to calculate wages and I need the spreadsheet to multiply hourly pay by hour worked for multiple employees. Specifically I need a specific cell to multiply and add 6 cells together across 3 rows and it is returning decimal numbers and that cell is affecting another cell i have that is supposed to divide that information with another cell and because i am getting decimal numbers it is throwing off the end result that i am looking for.

    1. Hello Adam,

      I'm sorry but your question is not clear.

      For me to be able to help you, please share a small sample spreadsheet with me (support@apps4gs.com) with 2 sheets: (1) a copy of your source data (2) the result you expect to get (the result sheet is of great importance and often gives us a better understanding than any text description). I kindly ask you to shorten the tables to 10-20 rows.

      Note. We keep that Google account for file sharing only and don't monitor its Inbox. Please do not email there. Once you share the file, just confirm by replying to this comment.

      Thank you.

  35. Hi, I have a sheet to work out staff hours and when time worked is over 24 hours for example 33:20:00 the formula i use to covnert this into a decimal amount of hours does not work and give me the amount of hours worked over 24 hours. I am using this formula below:

    =(HOUR(E59)+MINUTE(E59)/70+SECOND(E59)/3600). I have tried changing the data type of the cell to [hh]:mm:ss but this still doesnt work. Do you have any suggestions?

    Thank you!

    1. Hi Declan,

      33:20:00 already shows the duration of hours (33). You can either multiply this by 24 (see Example 3. Time difference in hours, minutes, and seconds; make sure the resulting cell is formatted as Number) or change the time format into elapsed hours only.

  36. Hi, thank you for this info.
    Just FYI, I think there is a typo in the extract the date/time section. Formula 2, says A2=B2, and I to match the image, it should say A2-B2.

    1. Hi Natalia,

      Thank you for your feedback!

      That is definitely a typo. I've just corrected it, thanks a lot! :)

  37. Hello,

    How would I check to see if a time is within a time range when the range goes past midnight? (i.e: The time to check is 03:00 and the time range is (21:00 - 5:00). Any help will be appreciated, thanks!

      1. Hello Natalia,

        The range is in one cell (i.e 5:00pm - 5:00am). I can parse out the separate times, but I can't get it to realize that a time (i.e 3:00am) is in between the range since the time value is lower than the beginning of the range.

        If it makes it easier to have each time in it's own cell, I can create helper columns (split) to separate them.

        1. Hello Jay,

          Assuming that 3:00am is in A2, 5:00pm – in B2, and 5:00am – in C2, the following formula will return TRUE if the time falls within the range, otherwise, you'll see FALSE:
          =OR(AND(B2>A2,C2>A2),AND(B2>A2,C2>A2))

  38. Hi Natalia, I'm sorry if this has already been asked/answered. I wondered if there was a way to add 2 seconds to a time formatted in a 00:00:00 AM/PM format. Ex( start time is 10:05:03 AM, and I want the end time to be 10:05:05 AM) I am trying to get a formula to add markers for video/audio edits quickly. This has been rattling around in my head for a while now, and I can't seem to figure it out! I would be super grateful if you knew how to accomplish this!

  39. Hello! I am having difficulty doing a duration countdown. I have cells with a date & time something is due (call it A1) and another cell with the NOW() function in it (call it B1) , those both work. When I do B1-A1 it returns a duration which counts down, however it's not the correct time. I read that google uses a different reference year and add a +1 at the end which worked for some, but as they get closer to less than 24 hours they then add 31 days on the front. For one that has 17 hours 33 mins remaining it states 31 days 17 hours 33 mins remaining.

    Any ideas?
    best,
    mattkwi

    1. Hello mattkwi,

      Can you please specify the exact date time from A1 and the result your B1-A1 returns so I could understand your case better?

  40. Hello, I'm trying to fix so that i can have name down in A, Times in minutes, seconds, and milliseconds in B, and the difference between them in C

    Example
    A B C
    Name Time Difference
    Rodney 1m:25s:754ms 0.000
    Peter 1m:26s:516ms ??????

    please help! :D Thank you :D

  41. Is it possible in Google Sheets to subtract 2 durations that are not linked to an AM/PM time? I am a swimming coach and I am hoping to use Sheets to calculate the difference between two race times. For example, I have a swimmer who swims the 50 yard butterfly. Her current time is 1:05.39 (mm, ss , ms) and her goal time is 35.83 (mm, ss, ms). Is there a formula I can use for this? One of the challenges is that I am subtracting different values (minutes and seconds capping out at 60 and then converting, milliseconds going all the way up to 100 before converting)

    Thanks for any feedback or guidance you can give!

    1. Hello Else-Marie,

      For Google Sheets to understand the exact format of the entered values, try the following:

      1. Enter your time records as a full duration, including zeros for hours: 00:01:05.39 and 00:00:35.83
      2. Go to Format > Number > Custom number format, and apply the following format to such numbers: hh:mm:ss.000

      Then try calculate these durations, it should work.

      1. Hi, I am also a coach that uses race times. I am having a very hard time as well.

        I have many athletes that have times in (mm, ss , ms) ONLY.

        I tried to use the format of hh:mm:ss.000 however it calculates to a 24 hour model. I am not using any hours at all in my splits for racing.

        I need something like this
        Athelte A- 1:04.75
        Goal time- 1:03.09
        I need the differences so it would be -1.66 so that my athlete knows that they need to drop 1 seconds and 66 mil seconds.

        Thanks for all your help

        1. Hi Andrew,

          If setting the custom number format doesn't work for you, try the custom date and time format instead with the following:
          Elapsed minutes (01):Elapsed seconds (01).Miliseconds (01)

          Make sure to apply the same format to the resulting cells.

  42. Hi,

    I think I read most of the comments and unfortunately I cannot find a solution to my problem.

    I need to add 52 hours to a date (08/11/2021 12:02:36) my problem is that I want to exclude the weekends.

    In this case A1 = start date and my formula is =A1+time(52,0,0), I tried using =WORKDAY.INTL but it doesn't work.

    Any help would be great and I love the your work.

    1. Hi Vytaute,

      Your formula to add 52 hours is incorrect. Here I mention the correct way (how to add more than 24 hours).

      And here's a formula to add those 52 hours ignoring the weekends:
      =IF(OR(WEEKDAY(A1+(52/24))=1,WEEKDAY(A1+(52/24))=7),IF(WEEKDAY(A1+(52/24))=1,A1+DAY(1)+(52/24),A1+DAY(2)+(52/24)),A1+(52/24))

      It adds 52 hours first and checks if the resulting date is Saturday or Sunday. If so, it adds 2 or 1 day correspondingly.

  43. Is it possible to calculate elapsed time in Sheets using a defined start date/time, and the CURRENT date/time as the end point? For example, if I specified a start date and time, is there a way for it to output the number of days, or preferably hours that have elapsed since then?

    1. Hi BJ,

      You can use NOW() and TODAY() functions instead of the specified end date/time, but these functions are volatile meaning they update themselves each time you open the spreadsheet or make edits anywhere in the file. Hence, your result will constantly update based on today's date/time.

      But you can also use these functions to get the required results first and then turn them into values to stop further recalculations.

  44. I am banging my head about this. I have a daily datetime stamps of a typical day at work starting at "10/22/2021 08:30:00 A" and ending at "10/22/2021 04:15:00 P". How can I filter out employees based on certain times of the day? Say 7 out of 10 employees start at 10/22/2021 12:15:00 P and end at 10/22/2021 03:15:00 P. How can I filter out those employees?

    Any help is greatly appreciated.

  45. Hi! I've used the following formula to find the duration of daily writing sprints:

    =IF(INT(E3-D3)>0, INT(E3-D3) & " days, ","") & IF(HOUR(E3-D3)>0, HOUR(E3-D3) & " hour(s), ","") & IF(MINUTE(E3-D3)>0, MINUTE(E3-D3) & " minutes ","") & IF(SECOND(E3-D3)>0, SECOND(E3-D3) & " seconds","")

    Now I want the sum of the duration times to find the total for the week. How can I do this?

    Once I do that, I'd like to sum across multiple pages/sheets within the document so I can find the total for the month. Is this possible?

    1. Hi Liz,

      For me to be able to help you better, please share a small sample spreadsheet with us (support@apps4gs.com) with 2 sheets: (1) a copy of your source data (2) the result you expect to get. The result sheet is of great importance and often gives a better understanding than any text description. I kindly ask you to shorten the tables to 10-20 rows. I'll look into it.

      Note. We keep that Google account for file sharing only, please do not email there. Once you share the file, just confirm by replying to this comment. I'll look into it.

      1. I have shared my spreadsheet example with you as requested.

        1. Hi Liz,

          I'm sorry for the delay in my reply, I was on sick leave. Please let me know if you're still looking for a solution, I'll look into your file then.

  46. You must get over 800 things

  47. Hi,
    I've got a starting date and a number of shift, If i sum the starting date and the shift it will find a delviery date, but I would love to avoid Holidays and week ends.
    Could you help me?

  48. Hi, is there a way to make it so it can calculate the time between two time frames if they're in the same cell?

    i.e

    8:00-13:00

    1. Hi Ryan,

      Yes, RIGHT & LEFT + SEARCH will help you out:
      =RIGHT(A2, SEARCH("-", A2))-LEFT(A2, SEARCH("-", A2)-1)

      Don't forget to apply the Duration format to the result.

      1. Thank you so much! I was starting to think that excel has skipped this part!!

        1. Hi,

          These are instructions for Google Sheets :) Note that Excel functions may have different arguments.

  49. hey, I was just wondering how to calculate elapsed time from velocity and distance in google sheets.

    1. Hello Tom,

      Could you please provide a couple of examples of your source records and of the result you'd like to get?

  50. Hi!

    This is article is pretty helpful. Do you have any idea of how to calculate time within/outside of business hours? For instance, if Column A's data is 1/1/2021 5:20AM and Column B's data is 1/6/2021 2:30PM, I'd like the total time elapsed minus the time we're unavailable (I can provide the business hours - but in this example let's say we're completely closed Sat/Sun and are open from 10am-5pm Mon-Friday)?

    Any help would be greatly appreciated.

    Thanks

    1. Hi AC,

      Thanks for stopping by our blog! :)

      Assuming your start time is in A2, end time – in B2, opening time – F2, closing time – G2, the following formula will do the trick:
      =(NETWORKDAYS(A2,B2)-1)*($G$2-$F$2)+MOD(B2,1)-MOD(A2,1)

      If there are any special holidays you'd like to take into account, you can set them right in the NETWORKDAYS function. You'll find a tutorial about it in this blog post.

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