Formula for calculating total time between two military times
Building a 'time tracker' to calculate total hours worked. Can someone help correct my formula(s)?
I'm using formulas found in this community but I might not be using them correctly. I'm expecting the Hours column to display "10.71" not "109.72".
Clock in Time:
=RIGHT(Created@row, 8)
Clock In (Military):
=((VALUE(LEFT([Clock In Time]@row, FIND(":", [Clock In Time]@row) - 1)) - IF(VALUE(LEFT([Clock In Time]@row, FIND(":", [Clock In Time]@row) - 1)) = 12, 12, 0) + IF(RIGHT([Clock In Time]@row, 2) = "pm", 12, 0)) + MID([Clock In Time]@row, FIND(":", [Clock In Time]@row) + 1, 2))
Clock Out (Military):
=((VALUE(LEFT([Clock Out Time]@row, FIND(":", [Clock Out Time]@row) - 1)) - IF(VALUE(LEFT([Clock Out Time]@row, FIND(":", [Clock Out Time]@row) - 1)) = 12, 12, 0) + IF(RIGHT([Clock Out Time]@row, 2) = "pm", 12, 0)) + MID([Clock Out Time]@row, FIND(":", [Clock Out Time]@row) + 1, 2))
Minutes:
=(VALUE(LEFT([Clock Out (Military)]@row, IF(LEN([Clock Out (Military)]@row) = 3, 1, 2)) + (VALUE(RIGHT([Clock Out (Military)]@row, 2)) / 60)) - (VALUE(LEFT([Clock In (Military)]@row, IF(LEN([Clock In (Military)]@row) = 3, 1, 2)) + (VALUE(RIGHT([Clock In (Military)]@row, 2)) / 60)))) * 60
Hours:
=Minutes@row / 60
Best Answer
-
It looks like you have some parenthesis off in the Minutes column.
=((VALUE(LEFT([Clock Out (Military)]@row, IF(LEN([Clock Out (Military)]@row) = 3, 1, 2))) + (VALUE(RIGHT([Clock Out (Military)]@row, 2)) / 60)) - (VALUE(LEFT([Clock In (Military)]@row, IF(LEN([Clock In (Military)]@row) = 3, 1, 2))) + (VALUE(RIGHT([Clock In (Military)]@row, 2)) / 60))) * 60
Come see me in Seattle at ENGAGE 2024! I will be at the 10xViz partner booth throughout as well as the "Lets Talk About Community" Meet & Eat table on Tuesday from 11:45am - 12:45pm!
Answers
-
It looks like you have some parenthesis off in the Minutes column.
=((VALUE(LEFT([Clock Out (Military)]@row, IF(LEN([Clock Out (Military)]@row) = 3, 1, 2))) + (VALUE(RIGHT([Clock Out (Military)]@row, 2)) / 60)) - (VALUE(LEFT([Clock In (Military)]@row, IF(LEN([Clock In (Military)]@row) = 3, 1, 2))) + (VALUE(RIGHT([Clock In (Military)]@row, 2)) / 60))) * 60
Come see me in Seattle at ENGAGE 2024! I will be at the 10xViz partner booth throughout as well as the "Lets Talk About Community" Meet & Eat table on Tuesday from 11:45am - 12:45pm!
-
@Paul Newcome Thank you! That was exactly it.
-
Happy to help. 👍️
Come see me in Seattle at ENGAGE 2024! I will be at the 10xViz partner booth throughout as well as the "Lets Talk About Community" Meet & Eat table on Tuesday from 11:45am - 12:45pm!
-
Follow up question to your above solution. What if you have to calculate the total minutes over a span of days? see the screen shot below I want to know the total minutes from admission time to departure time. But sometimes it is over a few days.
-
@Erin Kim Take a look through the below thread. There should be something in there to get you on your way.
Come see me in Seattle at ENGAGE 2024! I will be at the 10xViz partner booth throughout as well as the "Lets Talk About Community" Meet & Eat table on Tuesday from 11:45am - 12:45pm!
Help Article Resources
Categories
- All Categories
- 14 Welcome to the Community
- Smartsheet Customer Resources
- 62.8K Get Help
- 376 Global Discussions
- 207 Industry Talk
- 440 Announcements
- 4.5K Ideas & Feature Requests
- 139 Brandfolder
- 129 Just for fun
- 130 Community Job Board
- 449 Show & Tell
- 30 Member Spotlight
- 1 SmartStories
- 284 Events
- 33 Webinars
- 7.3K Forum Archives
Check out the Formula Handbook template!