Getting the duration between two times.

How can I calculate the duration between two different times and output that as just a decimal number, accounting for time durations that cross multiple days?


For example:

If I start work at 2pm and end at 5:30pm, I want the output to say "3.5", as in 3 and a half hours worked. If I start at 9pm and end the next day at 1am, the output says "4".

MacBook Pro 13″, macOS 13.2

Posted on Mar 6, 2023 1:34 PM

Reply
Question marked as Top-ranking reply

Posted on Mar 6, 2023 7:04 PM

If you want decimal hours, you can use DUR2HOURS, like this:





=DUR2HOURS(B2−A2)


I left the date showing to emphasize the fact that even when you display "just a time" in a cell there is a date there too. In your example, that 1am needs to have a date of the following date.


You may get more insights by having a look at the 'Employee Schedule' template at File > New in your menu.


For information on DUR2HOURS and other functions, together with lots of examples, go in your menu to Help > Formulas and Functions Help.


SG

1 reply
Question marked as Top-ranking reply

Mar 6, 2023 7:04 PM in response to imdop

If you want decimal hours, you can use DUR2HOURS, like this:





=DUR2HOURS(B2−A2)


I left the date showing to emphasize the fact that even when you display "just a time" in a cell there is a date there too. In your example, that 1am needs to have a date of the following date.


You may get more insights by having a look at the 'Employee Schedule' template at File > New in your menu.


For information on DUR2HOURS and other functions, together with lots of examples, go in your menu to Help > Formulas and Functions Help.


SG

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Getting the duration between two times.

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.