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
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
-
@Paul Newcome Thank you! That was exactly it.
-
Happy to help. 👍️
-
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.
Help Article Resources
Categories
- All Categories
- 14 Welcome to the Community
- Customer Resources
- 64.7K Get Help
- 434 Global Discussions
- 136 Industry Talk
- 470 Announcements
- 4.9K Ideas & Feature Requests
- 129 Brandfolder
- 148 Just for fun
- 64 Community Job Board
- 481 Show & Tell
- 33 Member Spotlight
- 2 SmartStories
- 298 Events
- 36 Webinars
- 7.3K Forum Archives
Check out the Formula Handbook template!