Calculate the difference once the cap is reached (overtime hours)

Domina

New Member
Joined
Mar 6, 2025
Messages
2
Office Version
  1. 365
Platform
  1. Windows
I have spent hours using all sorts of formulas and searching through excel forums but am still to find the solution. It seems to be simple, it seems I'm really close but it still does not give me the correct results. What I need is to cap the number of hours at 40 as soon as it's reached and move the remaining hours, if any, to the row below and on the day the cap was reached. Our employees have flexible schedule and are not required to work a minimum 8 hours a day, so sometimes they work less and sometime choose to come on weekends. In the example below row 23 shows the actual hours worked and in rows 24 & 25 I have formulas to separate regular time from the overtime. The 40 hours was reached on Friday at 4.5hr mark and the rest is overtime. All good so far:

1741274338265.png


The problem starts when there is a gap after the cap was reached, i.e. using the same example, the person reached the cap on Friday, did not work on Saturday but came to work on Sunday. This is what I get:

1741274391250.png


which is clearly incorrect - I have not enough regular hours and too many overtime hours. Here is another example:

1741274417065.png


Appreciate your help!
 
Try:
Book1
CDEFGHIJK
22MonTueWedThuFriSatSunTotal
23Timecard911.55.759.2511.2510.257.2564.25
24Hourly911.55.759.254.50040
25Overtime00006.7510.257.2524.25
26
27MonTueWedThuFriSatSunTotal
28Timecard911.55.759.2511.2507.2554
29Hourly911.55.759.254.50040
30Overtime00006.7507.2514
31
32MonTueWedThuFriSatSunTotal
33Timecard1211.512.759.2506051.5
34Hourly1211.512.753.7500040
35Overtime0005.506011.5
Sheet1
Cell Formulas
RangeFormula
K33:K34,K28:K29,K23:K24K23=SUM(D23:J23)
D24:J24,D34:J34,D29:J29D24=MAX(D23-MAX(SUM($D23:D23)-40,0),0)
D25:K25,D35:K35,D30:K30D25=D23-D24
 
Upvote 0
Solution
Thank you! I played around with min/max and couldn't get it to work - I see now what I missed. Much appreciated!
 
Upvote 0

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