Formula for calculating total time between two military times

Ami Veltrie
Ami Veltrie ✭✭✭✭✭✭
edited 02/19/24 in Formulas and Functions

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

Answers

Help Article Resources

Want to practice working with formulas directly in Smartsheet?

Check out the Formula Handbook template!