Calculate overtime/lost time from a range of cells.

xblft1

New Member
Joined
Sep 11, 2018
Messages
9
Hi all,

I have a table of how many hours each employee worked in each day of the month.
I am trying to calculate their overtime and any time loss without having to create new tables.

Sumifs was my 1st thought however it adds cell values where what i want is to add the cell value minus 8:00:00 when this is not negative.

Example of what the data looks like:

Employee 1: 8:32:08, 8:35:13, 7:53:00

The result here should be 1:07:21 (overtime from the 1st two days, no discount for the 3rd day as the loss is to be calculated separately).

My data is a large number of staff for a whole month (and possibly will be a periodic task) so I'm looking for formulas to get those figures for each employee easily.

Any help would be greatly appreciated.
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
No, apologies if confusing.
My table has a column for each day of the month and a line for each employee. I can make a mock table if need be.
 
Upvote 0
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD][/TD]
[TD]Day 1[/TD]
[TD]Day 2[/TD]
[TD]Day 3[/TD]
[TD]...[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Employee 1[/TD]
[TD]8:32:08[/TD]
[TD]8:35:13[/TD]
[TD]7:53:00[/TD]
[TD]...[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Employee 2[/TD]
[TD]8:11:14[/TD]
[TD]8:22:17[/TD]
[TD]8:01:13[/TD]
[TD]...[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]


This is what my data looks like.
I am trying to avoid the need to create a separate table that calculates overtime for each particular day.
As mentioned before, the formula should compare the daily registered hours to 8:00:00 and sum up the non-negative differences.

Many thanks again for looking.
 
Upvote 0
Ok maybe one of these:

=SUMPRODUCT(--(B2:AF2>TIME(8,0,0)),(B2:AF2-TIME(8,0,0)))
=SUMIFS(B2:AF2,B2:AF2,">"&TIME(8,0,0))-(TIME(8,0,0)*COUNTIFS(B2:AF2,">"&TIME(8,0,0)))
 
Upvote 0

Excel 2010
ABCDEF
18:00:00Day 1Day 2Day 3
2Employee 18:32:088:35:137:53:0001:07:21
3Employee 28:11:148:22:178:01:1300:34:44
4
5or
68Day 1Day 2Day 3
7Employee 18:32:088:35:137:53:001.12
8Employee 28:11:148:22:178:01:130.58
9
6a
Cell Formulas
RangeFormula
F2=SUMPRODUCT(--(B2:E2>$A$1),(B2:E2-$A$1))
F7=SUMPRODUCT(--(B7:E7*24>$A$6),(B7:E7*24-$A$6))
 
Upvote 0
Thank you both for the swift responses.
How would those look for calculating time loss?
Here I am looking only to count the days where they worked below 8hrs. I am trying to adapt the formulas but I seem to be missing something.
 
Upvote 0
Forgot to mention - I have days where they worked 0 hours in the list. My trouble is preventing the formula from returning -8 hours for those (when calculating time loss).

many thanks again.
 
Upvote 0
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD][/TD]
[TD]Day 1[/TD]
[TD]Day 2[/TD]
[TD]Day 3[/TD]
[TD]Day 4[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Employee 1[/TD]
[TD]8:32:08[/TD]
[TD]8:35:13[/TD]
[TD]7:53:00[/TD]
[TD]0:00:00[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Employee 2[/TD]
[TD]8:11:14[/TD]
[TD]8:22:17[/TD]
[TD]8:01:13[/TD]
[TD]0:00:00[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Employee 3[/TD]
[TD]7:32:22[/TD]
[TD]0:00:00[/TD]
[TD]8:08:11[/TD]
[TD]8:11:22[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

A sample table to show my issue when trying to calculate time loss.
Employee 1 has 0:07:00 time loss (7 min on day 3, none on Day 1&2, didn't work on Day 4)
Employee 2 should return 0:00:00
Employee 3 should return 0:27:44

Not sure how to exclude the days with zero worked hours from the results.

Thank you for looking.
 
Upvote 0
A few examples would be useful.


Excel 2010
ABCDEF
10Employee 18:32:088:35:134:53:0003:07:00
11Employee 28:11:144:22:178:01:1303:37:43
12
13or
148Day 1Day 2Day 3
15Employee 18:32:088:35:134:53:003.12
16Employee 28:11:144:22:178:01:133.63
17
6a
Cell Formulas
RangeFormula
F10=SUMPRODUCT(--(B10:E10<$A$1),--(B10:E10>0),($A$1-B10:E10))
F15=SUMPRODUCT(--(B15:E15*24<$A$14),--(B15:E15>0),($A$14-B15:E15*24))
 
Upvote 0

Forum statistics

Threads
1,223,908
Messages
6,175,307
Members
452,633
Latest member
DougMo

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top