Overtime Calculation

ChetanPuri

Board Regular
Joined
Sep 5, 2018
Messages
60
Office Version
  1. 365
Platform
  1. Windows
Dear Excel Team,

I am seeking some assistance in building a formula for our employees who work in shifts. Our company policy dictates that if an employee does not have an 8 hour break between the start of their shift, then the entire 7.5 hour shift should be paid at double time.

I am looking to create a formula that can calculate the time between two dates, the actual start and end time of a shift, and then populate Column U with the entire shift as OT2. For example, if an employee started their shift at 3:00 PM (Row 11, Column N) and ended at 10:30 PM (Row 11, Column P), and then had a sleepover shift for work purposes, and then worked another shift from 6:30 PM to 8:30 PM on August 8th, 2022, then those two hours would be considered overtime.

Similarly, if an employee started another shift on August 8th at 3:00 PM and the gap between their previous shift and the start of this shift was only 6.5 hours, then the entire 7.5 hour shift would be considered overtime.

I would appreciate any help in creating a formula for this.

Thank you for your assistance.

Best regards,
Chetan
Book1
ABCDEFGHIJKLMNOPQRSTU
3Employee CodeEmployment TypeMobile Number
4Shift TypeShift DateDepartmentRoleAreaPay RateRoster Net HoursTimesheet Net HoursRostered Start TimeRostered End TimeActual Start TimeActual End TimeNo.of HRS Break between timeframeNormal HoursSleep OverOT1.5OT2.0
11NormalSunday7/08/2022Supported LivingTeam Leader DS$42.550.007.5015:0022:307.50 
12NormalSunday07/08/2022Supported LivingSleepover$42.550.000.0022:3006:308.00 
13NormalMonday18/08/2022Supported LivingTeam Leader DS$42.552.002.0006:3008:3006:3008:302.002.00
14NormalMonday08/08/2022Supported LivingTeam Leader DS$42.557.507.5015:0022:3015:0022:307.506.507.50
15NormalMonday08/08/2022Supported LivingSleepover$42.550.000.0022:3006:300.008.000.00
16NormalTuesday19/08/2022Supported LivingTeam Leader DS$42.552.002.0006:3008:3006:3008:302.002.00
17NormalTuesday09/08/2022Supported LivingTeam Leader DS$42.557.507.5015:0022:3015:0022:307.506.507.50
18NormalTuesday09/08/2022Supported LivingSleepover$42.550.000.0022:3006:300.008.000.00
19NormalWednesday110/08/2022Supported LivingTeam Leader DS$42.552.002.7506:3008:3006:3009:152.756.502.75
WorkHistoryReport
Cell Formulas
RangeFormula
B11:B19B11=TEXT(D11,"DDDD")
P11,P19,P16:P17,P13:P14P11=IF(N11="","",MOD(O11-N11,1))*24
C12:C19C12=D12-D11
S12,S18,S15S12=MOD(M12-L12,1)*24
Q14,Q19,Q17Q14=MOD(N14-O13,1)*24
Q15,Q18Q15=IF(C15>=1,MOD(N15-O14,1))*24
U11:U12,U14:U15,U17:U18U11=IF(Q11="","",IF(Q11>=8," ",P11))
U13,U16,U19U13=P13
 

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
I had to copy the Rostered Date/Times over to the actual Date/Times to make this work

Book2
ABCDEFGHIJKLMNOPQRSTU
3Employee CodeEmployment TypeMobile Number
4Shift TypeShift DateDepartmentRoleAreaPay RateRoster Net HoursTimesheet Net HoursRostered Start TimeRostered End TimeActual Start TimeActual End TimeNo.of HRS Break between timeframeNormal HoursSleep OverOT1.5OT2.0
11NormalSunday8/7/2022Supported LivingTeam Leader DS42.5507.508/07/2022 15:0008/07/2022 22:307.500.00
12NormalSunday08/7/2022Supported LivingSleepover42.550008/07/2022 22:3008/08/2022 06:3008/07/2022 22:3008/08/2022 06:308.000.00
13NormalMonday18/8/2022Supported LivingTeam Leader DS42.552208/08/2022 06:3008/08/2022 08:3008/08/2022 06:3008/08/2022 08:302.002.00
14NormalMonday08/8/2022Supported LivingTeam Leader DS42.557.57.508/08/2022 15:0008/08/2022 22:3008/08/2022 15:0008/08/2022 22:307.506.507.50
15NormalMonday08/8/2022Supported LivingSleepover42.550008/08/2022 22:3008/09/2022 06:3008/08/2022 22:3008/09/2022 06:300.008.000.00
16NormalTuesday18/9/2022Supported LivingTeam Leader DS42.552208/09/2022 06:3008/09/2022 08:3008/09/2022 06:3008/09/2022 08:302.002.00
17NormalTuesday08/9/2022Supported LivingTeam Leader DS42.557.57.508/09/2022 15:0008/09/2022 22:3008/09/2022 15:0008/09/2022 22:307.506.507.50
18NormalTuesday08/9/2022Supported LivingSleepover42.550008/09/2022 22:3008/10/2022 06:3008/09/2022 22:3008/10/2022 06:300.008.000.00
19NormalWednesday18/10/2022Supported LivingTeam Leader DS42.5522.7508/10/2022 06:3008/10/2022 08:3008/10/2022 06:3008/10/2022 09:152.750.002.75
WorkHistoryReport
Cell Formulas
RangeFormula
B11:B19B11=TEXT(D11,"DDDD")
P11,P19,P16:P17,P13:P14P11=IF(N11="","",MOD(O11-N11,1))*24
C12:C19C12=D12-D11
S12,S18,S15S12=MOD(M12-L12,1)*24
Q14,Q19,Q17Q14=MOD(N14-O13,1)*24
Q15,Q18Q15=IF(C15>=1,MOD(N15-O14,1))*24
U11:U19U11=IF(AND(F11<>"Sleepover",MAX($O2:O10)<>0,ROUND(N11-MAX($O2:O10),4)*24<=8),P11,0)
 
Upvote 0
I had to copy the Rostered Date/Times over to the actual Date/Times to make this work

Book2
ABCDEFGHIJKLMNOPQRSTU
3Employee CodeEmployment TypeMobile Number
4Shift TypeShift DateDepartmentRoleAreaPay RateRoster Net HoursTimesheet Net HoursRostered Start TimeRostered End TimeActual Start TimeActual End TimeNo.of HRS Break between timeframeNormal HoursSleep OverOT1.5OT2.0
11NormalSunday8/7/2022Supported LivingTeam Leader DS42.5507.508/07/2022 15:0008/07/2022 22:307.500.00
12NormalSunday08/7/2022Supported LivingSleepover42.550008/07/2022 22:3008/08/2022 06:3008/07/2022 22:3008/08/2022 06:308.000.00
13NormalMonday18/8/2022Supported LivingTeam Leader DS42.552208/08/2022 06:3008/08/2022 08:3008/08/2022 06:3008/08/2022 08:302.002.00
14NormalMonday08/8/2022Supported LivingTeam Leader DS42.557.57.508/08/2022 15:0008/08/2022 22:3008/08/2022 15:0008/08/2022 22:307.506.507.50
15NormalMonday08/8/2022Supported LivingSleepover42.550008/08/2022 22:3008/09/2022 06:3008/08/2022 22:3008/09/2022 06:300.008.000.00
16NormalTuesday18/9/2022Supported LivingTeam Leader DS42.552208/09/2022 06:3008/09/2022 08:3008/09/2022 06:3008/09/2022 08:302.002.00
17NormalTuesday08/9/2022Supported LivingTeam Leader DS42.557.57.508/09/2022 15:0008/09/2022 22:3008/09/2022 15:0008/09/2022 22:307.506.507.50
18NormalTuesday08/9/2022Supported LivingSleepover42.550008/09/2022 22:3008/10/2022 06:3008/09/2022 22:3008/10/2022 06:300.008.000.00
19NormalWednesday18/10/2022Supported LivingTeam Leader DS42.5522.7508/10/2022 06:3008/10/2022 08:3008/10/2022 06:3008/10/2022 09:152.750.002.75
WorkHistoryReport
Cell Formulas
RangeFormula
B11:B19B11=TEXT(D11,"DDDD")
P11,P19,P16:P17,P13:P14P11=IF(N11="","",MOD(O11-N11,1))*24
C12:C19C12=D12-D11
S12,S18,S15S12=MOD(M12-L12,1)*24
Q14,Q19,Q17Q14=MOD(N14-O13,1)*24
Q15,Q18Q15=IF(C15>=1,MOD(N15-O14,1))*24
U11:U19U11=IF(AND(F11<>"Sleepover",MAX($O2:O10)<>0,ROUND(N11-MAX($O2:O10),4)*24<=8),P11,0)
Thank you Kindly, it worked perfectly, much appreciated.
 
Upvote 0

Forum statistics

Threads
1,215,068
Messages
6,122,950
Members
449,095
Latest member
nmaske

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