Forum Discussion
Excel - calculating hours worked on single cell values
- Jan 13, 2021
In I3 as an array formula, confirmed with Ctrl+Shift+Enter:
=SUM(IFERROR(MOD(TIMEVALUE(RIGHT(B3:H3,5))-TIMEVALUE(LEFT(B3:H3,5)),1),0))
Apply the custom number format [h]:mm to I3, then fill down.
In I3 as an array formula, confirmed with Ctrl+Shift+Enter:
=SUM(IFERROR(MOD(TIMEVALUE(RIGHT(B3:H3,5))-TIMEVALUE(LEFT(B3:H3,5)),1),0))
Apply the custom number format [h]:mm to I3, then fill down.
HansVogelaar
Hello HansVogelaar,
Hope you're well. Ive seen your work above, and was hoping you can assist in providing with a formula that would work for the format I have in https://docs.google.com/spreadsheets/d/1rhXorSRabhfnQirU-5f8eTpmZQE9zGXE/edit?usp=sharing&ouid=117244844375929167928&rtpof=true&sd=true. Essentially I want to calculate total hours scheduled in column M, this formula should take into account "OFF", "PTO".
Thank you in advance for your assistance.
- HansVogelaarJul 28, 2024MVP
In M12:
=SUM(IFERROR(TIMEVALUE(TEXTAFTER(D12:K12, " - "))-TIMEVALUE(TEXTBEFORE(D12:K12, " - ")), 0))
Apply the custom number format [h]:mm to M12 to allow for total times over 24 hours.
Copy M12 and paste to the cells below where you want a total.
See attached version.