Case 3: Working hours compliance check
Timesheets are easy to keep, but who checks the breaks, the rest between shifts and the weekly hours? You build a check that flags every problem day by itself, then review eight weeks of hours for a whole team against the UK 48-hour average and US overtime rules.
In short: hours = (end-start)*24-break/60, required break with IF, daily rest from date plus time, the flag with IF(OR(…)). For the weekly review, SUMPRODUCT adds up overtime week by week. Time arithmetic from scratch is in the lesson Calculate time, rest periods in shift work in the shift rota.
The situation
November is busy in a wholesaler's warehouse. The staff forum has asked whether the long days are still within the rules. HR has two things to show at the next meeting: a check of one week for Ms Carter, whose times looked unusual, and an eight-week review for five employees.
The rules this case uses
UK (adult workers)
- One uninterrupted 20-minute rest break during the working day for anyone working more than 6 hours (gov.uk: rest breaks at work).
- 11 hours' rest between working days (same page).
- No more than 48 hours a week on average, normally averaged over 17 weeks; workers can choose to opt out (gov.uk: maximum weekly working hours).
Young workers have different limits, and some jobs are exempt; the workbook covers adult workers only.
US (federal)
- Covered, non-exempt employees must get overtime pay for hours worked over 40 in a workweek, at least one and a half times the regular rate. A workweek is a fixed period of seven consecutive 24-hour periods, and averaging hours over two or more weeks is not allowed (dol.gov: overtime pay).
- Federal law does not require lunch or coffee breaks (dol.gov: breaks). Some states do, so check your state's rules.
The workbook flags what should be looked at. It does not decide whether a rule was broken.
The workbooks sheet by sheet
- Times: date, weekday, start and end as times, break in minutes. H2 holds the rest before the first day, from the previous week.
- Rules: 11 hours' daily rest, a break after more than 6 hours, 20 minutes. If your rules differ, for example under state law or an agreement, you change this sheet only.
- Weeks (task 2): five people, eight weeks of hours, with a rules sheet holding the 48-hour average and the 40-hour overtime threshold.
Task 1: check one week
F2 already holds a formula from the old file. It produces nonsense, and your first job is to fix it.
Task Check Ms Carter's times against the UK rules for adult workers. F2 already holds a formula that gets it wrong: fix it so F2 shows the working hours as a decimal (end minus start minus the break in minutes). G2: the break needed in minutes, from the Rules sheet (more than 6 hours: 20, otherwise 0). H3: rest in hours since the end of the previous working day (H2 comes from last week). I2: "check" if the break is too short or the rest is under 11 hours, otherwise "ok". All formulas down to row 8. B11: the number of days marked "check".
| A | B | C | D | E | F | G | H | I | J | |
|---|---|---|---|---|---|---|---|---|---|---|
| 1 | Date | Day | Start | End | Break min | Hours | Break needed | Rest h | Check | |
| 2 | 16 Nov 2026 | Mon | 7:00 | 16:30 | 45 | 62 | ||||
| 3 | 17 Nov 2026 | Tue | 7:30 | 18:15 | 30 | |||||
| 4 | 18 Nov 2026 | Wed | 6:00 | 14:30 | 30 | |||||
| 5 | 19 Nov 2026 | Thu | 12:00 | 21:45 | 45 | |||||
| 6 | 20 Nov 2026 | Fri | 7:00 | 15:00 | 15 | |||||
| 7 | 21 Nov 2026 | Sat | 8:00 | 13:30 | 0 | |||||
| 8 | 23 Nov 2026 | Mon | 6:30 | 17:00 | 30 | |||||
| 9 | ||||||||||
| 10 | ||||||||||
| 11 | Days to check | |||||||||
| 12 | ||||||||||
| 13 |
| A | B | C | |
|---|---|---|---|
| 1 | Minimum daily rest (h) | 11 | |
| 2 | Break needed when working more than (h) | 6 | |
| 3 | Minimum break (min) | 20 | |
| 4 | |||
| 5 |
Step 1: fix the broken formula
=D2-C2-E2 subtracts a 45-minute break as 45 whole days from a fraction of a day. Times in Excel are fractions of a day, so multiply the difference by 24 to get hours and divide the minutes by 60: =(D2-C2)*24-E2/60.
Step 2: required break and daily rest
G2 is =IF(F2>Rules!$B$2,Rules!$B$3,0). The rest period runs from the end of the previous day to the start of this one. Because midnight lies in between, you calculate with date plus time: =((A3+C3)-(A2+D2))*24. That also works across the weekend.
Step 3: the flag
=IF(OR(E2<G2,H2<Rules!$B$1),"check","ok") flags a day as soon as either condition is true. B11 counts the flagged days with COUNTIF. If the report needs to show which rule applies, use one column per rule instead.
Note what the UK rules do not flag: Tuesday's 10.25 hours. There is no daily maximum for adults, only the weekly average, which is what task 2 looks at.
Task 2: eight weeks at a glance
The same eight weeks answer two different questions. For the UK, is the average above 48 hours? For the US, how many overtime hours have to be paid? Overtime is counted week by week, because the FLSA does not allow averaging: a 44-hour week brings 4 hours, and a 35-hour week takes nothing away.
Task Eight weeks of hours for five employees. J2: average per week. K2: longest week. L2: the number of weeks over the limit in Rules!B1. M2: overtime hours over 40, worked out week by week (weeks below 40 count as 0, nothing is averaged). N2: "average too high" if J2 is over the limit, otherwise "ok". Everything down to row 6. B8: overtime of all five together.
| A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | Name | Week 1 | Week 2 | Week 3 | Week 4 | Week 5 | Week 6 | Week 7 | Week 8 | Average | Maximum | Weeks > 48 | Overtime h | Note | |
| 2 | Carter | 42 | 45 | 50 | 38 | 44 | 52 | 47 | 40 | ||||||
| 3 | Nolan | 40 | 40 | 41 | 39 | 40 | 42 | 40 | 38 | ||||||
| 4 | Shaw | 55 | 50 | 49 | 52 | 46 | 48 | 51 | 50 | ||||||
| 5 | Baxter | 36 | 38 | 40 | 44 | 35 | 30 | 38 | 40 | ||||||
| 6 | Dixon | 48 | 49 | 47 | 50 | 46 | 49 | 48 | 47 | ||||||
| 7 | |||||||||||||||
| 8 | Total overtime | ||||||||||||||
| 9 | |||||||||||||||
| 10 |
| A | B | C | |
|---|---|---|---|
| 1 | Weekly average limit (UK, 48 h) | 48 | |
| 2 | Overtime after (US FLSA, 40 h per workweek) | 40 | |
| 3 | |||
| 4 |
This exercise is part of Premium.
Premium unlocks every exercise in every lesson, unlimited practice with fresh tasks and the final test with certificate.
See Premium Already Premium? Log in
The first exercise in this lesson is free.
=SUMPRODUCT((B2:I2>Rules!$B$2)*(B2:I2-Rules!$B$2)) does this without helper rows: the first part is 1 or 0 for each week, the second part the difference. For time off in lieu instead of payment, the overtime tracker shows a running balance. More on the idea in the lesson on SUMPRODUCT.
Common mistakes
Subtracting minutes from a time
Exactly the bug in F2. When you mix times and minutes, bring everything into one unit first, here hours.
Rest from times only
=(C3-D2)*24 gives a negative number for Tuesday 7:30 minus Monday 16:30. Without the date, Excel does not know a night lies in between.
Overtime from the average
=(J2-40)*8 nets short weeks against long ones. For Baxter it would even be negative, although week 4 had 4 hours of overtime.
Greater than or greater than or equal
Dixon averages exactly 48. "More than 48" is the limit, so "ok" is right. With >= instead of > the flag would be wrong. Check every threshold for which one the rule means.
How to check your result
- Task 1: hours 8.75, 10.25, 8, 9, 7.75, 5.5 and 10. Only Friday is flagged: a 15-minute break and only 9.25 hours of rest after Thursday's late finish. B11 is 1.
- Task 2: averages 44.75, 40, 50.125, 37.625 and 48; only Shaw is above 48. Total overtime 192 hours.
- Check by hand: Nolan has only two weeks over 40, week 3 with 41 and week 6 with 42 hours, so his overtime is 1 + 2 = 3 hours.
The functions in German Excel
| English | German |
|---|---|
| IF, OR | WENN, ODER |
| COUNTIF | ZÄHLENWENN |
| AVERAGE, MAX | MITTELWERT, MAX |
| SUMPRODUCT, SUM | SUMMENPRODUKT, SUMME |
German Excel separates arguments with a semicolon.
Excel versions
All functions in this case work in every current version of Excel. If you add up times in time format, use the number format [h]:mm so totals over 24 hours do not start again at 0; the decimal hours in this workbook do not need it.
Back to the course overview.