# Formula for calculating total time between two military times

Options
✭✭✭✭✭✭
edited 02/19/24

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

• ✭✭✭✭✭✭
Options

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

• ✭✭✭✭✭✭
Options

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

• ✭✭✭✭✭✭
Options

@Paul Newcome Thank you! That was exactly it.

• ✭✭✭✭✭✭
Options

Happy to help. 👍️

• ✭✭✭✭✭
Options

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.

• ✭✭✭✭✭✭
Options

@Erin Kim Take a look through the below thread. There should be something in there to get you on your way.

## Help Article Resources

Want to practice working with formulas directly in Smartsheet?

Check out the Formula Handbook template!