Excel doesn't play nice with time as a quantity, in my experience. It really only deals with it in terms of actual points in history. So you'll want to simply use two formulas, both of which divide your original number by 60, to get what you're after:
| Minutes Worked | Hours:Minutes Worked | Hours:Minutes Over 1 Hour
100 1:40 0:40
Column 1: Data entered by you, time worked in minutes
Column 2: =QUOTIENT(A1,60)&":"&MOD(A1,60)
Column 3: =QUOTIENT((A1-60),60)&":"&MOD(A1,60)
Those formulas should work. Column two finds the hours worked by taking the value in column 1 and dividing it by 60, and then rounding down (FLOOR
) to get rid of the remainder. It then finds the minutes by doing the opposite. It takes the value entered and divides by 60 and returns the remainder (MOD
). Since the minutes left hour the hours are always going to be 0-59, you get your minutes.
The second column does the exact same thing, but it subtracts 60 (1 hour) from column 1 first.
Both of them separate the values of the hours and minutes with ":" by simply placing it in between the two values.
If you want to find the sum of all of this overtime, you just need to add a SUM
formula underneath the first column, and then use the exact same formulas from the second and third column to convert that some to your desired format.
Update:
First, I changed the above code, replacingFLOOR
with QUOTIENT
, since Floor throws errors when the number is below 1.
Second, if you want to have a negative number for when you work under an hour, you can use a conditional that says that when minutes worked is > 59 to use the formula, but otherwise to subtract 60 from the number of minutes difference from 60 (MOD
). I would do it the other way around to get the proper negative number, but then it looks like 00:-20
for when you work 40 minutes, and who wants that? Instead we manually add the -00 in the front.
And since we're doing all that, I figure you want "00" instead of just "0" for when you have amounts like 0:30 minutes over or 5:0 hours over. So that can be done by wrapping the entire number (the hours number or the minutes number, not the entire cell) in a TEXT(number, "00")
function. The end result is hairy but looks like:
Function for finding total hours:minutes from minutes
=TEXT(QUOTIENT(A1,60),"00")&":"&TEXT(MOD(A1,60),"00")
Function for finding hours:minutes (positive or negative) over first hour:
=IF(A1 > 59,TEXT(QUOTIENT((A1-60),60),"00")&":"&TEXT(MOD(A1,60),"00"),"-00"&":"&TEXT(60-MOD(A1,60),"00"))