Source: https://oguzerol.com/en/shift-scheduling-web-app/
[ View full size](https://oguzerol.com/gorseller/hizmet-kapaklari/vardiya-planlama-web-uygulamasi-webapp-v1-en.webp)
# Shift Scheduling: Skills Matrix, 11-Hour Rest, Night Rotation and an Excel Setup
[Oğuz Erol](https://oguzerol.com/en/about-me/) | 12 min read
A three-shift rota must answer four questions: does every line-shift have enough qualified people, are leave and sickness out of the plan, do swaps break the rest between shifts, and does the noticeboard show who is actually working? Excel can check the first three with cell codes, COUNTIFS and conditional formatting. What it cannot catch is a verbally approved swap that reaches the file and the noticeboard late.
## Fixed or rotating: how do you choose a shift pattern?
The pattern decides who works nights and when. In a **fixed pattern** everyone always works the same shift; in a **rotating pattern** crews change shift at set intervals. In the example’s weekly forward rotation a crew works one week early, one week late, one week nights.
Then ask: are minimum rest and the weekly rest day built into changeovers? In the example below (three 8-hour shifts, forward rotation, Sunday off) the shortest changeover is 24 hours, from Saturday night to Monday morning. If the pattern passes, later problems come from exceptions: leave, sickness, swaps and extensions.
## Which legal limits does a rota have to carry?
The rota carries legal limits as checks; your employment lawyer decides which apply.
**If you are in Turkey:** I read Articles 41, 63 and 69 of Labour Law No. 4857 and the regulation on work in shifts (Official Gazette 07.04.2004/25426) on 01.11.2026 in the current text on mevzuat.gov.tr ([Law 4857](https://www.mevzuat.gov.tr/mevzuat?MevzuatNo=4857&MevzuatTur=1&MevzuatTertip=5); latest amendment I saw: 29.06.2024). They set at least 11 hours’ rest when a worker’s shift changes, a 7.5-hour cap on night work outside a few listed sectors, at most one working week of nights before a day week (a two-week rotation is also allowed), a weekly rest day of at least 24 hours, no night shifts for workers under 18, and posting of shift lists and changes. The [Turkish version of this page](https://oguzerol.com/vardiya-planlama-web-uygulamasi/) cites each article.
## Example: one month at a four-line injection moulding plant
*The plant, crews and all figures are fictional; I calculated the numbers in a script.*
A plastic injection moulding plant runs 4 lines (H1–H4) on three shifts: **E** (early) 06:00–14:00, **L** (late) 14:00–22:00, **N** (night) 22:00–06:00. Each shift is 8 hours with a 30-minute break: 7.5 hours of work. Production runs Monday to Saturday; Sunday is everyone’s rest day. Three crews rotate weekly, forwards. Each crew has 5 people per line plus 4 spares: 24 people, 72 in total.
A **skills matrix** shows who can do which job. The rule: 5 people on every line-shift and at least 1 mould setter; robotic line H4 also needs 1 robot-qualified person. Of the 72, 15 are setters and 6 robot-qualified, including one spare of each per crew.
The four-week rota has 72 × 28 = **2,016 cells**, 1,728 of them on production days. There are **288 line-shifts** to fill. The month had 36 person-days of planned leave, 19 person-days of unplanned absence (sick notes or no-shows) and 9 swap requests. At month end:
- **13 line-shifts lacked a qualified person:** 11 had no setter, 2 had nobody robot-qualified. The first available spare in sheet row order had been written in; while one crew’s H2 setter was on leave for three days, the H2 early shift ran three days without a setter. A skill-aware rule closes 11 of the 13 with the same spares; for the other 2, no qualified spare was available.
- **11 person-changeovers had less than 11 hours’ rest:** 9 had 8 hours, 2 had zero. In the zero cases someone leaving the night shift was entered on the early shift at 06:00 the same morning: 16 hours without a break on paper. All came from 6 single-day swaps.
- **4 swaps reached the rota late:** approved verbally, entered on or after the swap day; the noticeboard showed the wrong people. These 4 swaps carried 7 of the 11 short rests.
- **3 people’s night run exceeded one working week:** one worked 7 nights in 8 days after swapping onto a Saturday night, one 12 nights in 13 days after a full-week swap. The third was left on last week’s night row when a week was opened by copy and paste: also 12 in 13.
- **2 extensions added 8 hours of overtime:** on two days, a different crew each time was 5 people short and 4 spares were not enough; one person from the previous shift stayed 4 hours each time, taking the week to 49 hours. One extension ran the late shift on to 02:00; the extra 22:00–02:00 falls in the night period.
## Where does an Excel rota break?
An Excel rota breaks in four places; every problem in the example month falls into one of them.
1. **Opening a week by copy and paste.** The rotation must be turned by hand; a row moved by a swap gets left behind, and last week’s leave marks come along.
2. **Skill gaps are invisible.** The cell shows only the shift, not whether the spare is a setter. The line looks full while the skill is missing.
3. **Swaps do not reach the plan.** A request arrives by phone, is approved verbally and the file is updated later; until then it skips the rest check and the hours count.
4. **Nobody knows the latest version.** With “final”, “final2” and “revised” copies and a printout pinned up on Saturday, nobody knows which is valid.
## A sound Excel setup: cell codes, COUNTIFS and conditional formatting
If you stay with a spreadsheet, build one **Rota** sheet: one row per person, one column per calendar day.
A Staff ID · B Name · C Crew · D Setter · E Robot · F–AG 28 days
D and E hold “Yes” or blank: the skills matrix sits beside the plan. Each day cell holds the shift letter and the line number together: `E2` is early shift, H2. Leave is `V`, sickness or absence `X`, Sunday `R`, an extension `L4+4` (late, H4, 4 extra hours). Pick codes from a Data Validation list. Take planned leave from approved records in your [employee leave tracker](https://oguzerol.com/en/employee-leave-tracking-app/); supervisors enter same-day absence as `X`.
Below, add check rows for every line-shift (comma separators):
```
Setters (E2): =COUNTIFS($D$2:$D$73,"Yes",F$2:F$73,"E2*")
People (E2): =COUNTIFS(F$2:F$73,"E2*")
```
`COUNTIFS(criteria_range1, criteria1, [criteria_range2, criteria2]…)` matches all criteria in the same row and accepts `*` and `?` wildcards; ranges must be the same size ([Microsoft: COUNTIFS](https://support.microsoft.com/en-us/office/countifs-function-dda3dc6e-f74e-4aee-88bc-aa8c2a866842)). The wildcard is there for extensions: `"E2"` alone would miss `E2+4`. Keep line numbers to one digit; `"E1*"` also counts `E10`. The robot row is the same formula on column E. Add a formula-based rule via Home > Conditional Formatting > New Rule: red when setters are 0 or people fewer than 5. An extended shift still shows 4: its last 4 hours are open.
In the same month these checks would have flagged the 13 gaps, 11 short rests, 3 night runs and 8 hours; only the 4 late-entered swaps stay invisible until entered.
For rest, add another rule to the day cells (G2:AG73):
```
=OR(LEFT(F2,1)&LEFT(G2,1)="LE",
LEFT(F2,1)&LEFT(G2,1)="NE",
LEFT(F2,1)&LEFT(G2,1)="NL")
```
With the example’s hours, these are the only consecutive-day pairs under 11 hours: late to early 8 hours, night to early 0, night to late 8. A 4-hour extension adds no new pair. Because Sunday holds `R`, Saturday to Monday raises no false alarm. Different hours need a new pair list.
For night runs, add this to M2:AG73: `=COUNTIFS(F2:M2,"N*")>=7`. Seven nights in 8 days (Sunday included) means the run exceeds one working week. On a two-week rotation the window is 15 days and the threshold 13.
## How does the rota count overtime?
The rota counts overtime in hours, not pay. Add one column per week (first week F:L):
```
AH2: =7.5*(COUNTIFS(F2:L2,"E*")+COUNTIFS(F2:L2,"L*")
+COUNTIFS(F2:L2,"N*"))+4*COUNTIFS(F2:L2,"*+4")
AI2: =MAX(0,AH2-45)
```
In the example, the two people who extended reach 49 hours, 4 each in AI. 45 is the Turkish threshold; use your own, track the average if hours are averaged, and total the weekly columns for an annual cap. Flag extensions into the night period for your lawyer; pay is for payroll.
## What should a swap request pass before approval?
A swap request should pass four checks before approval: equal qualification, 11 hours’ rest for both afterwards, no longer night run and no week over 45 hours.
In the example pattern I tried every single-day weekday swap in the script: whatever the day and shifts, at least one person’s rest falls below 11 hours, because the swapper returns to their own shift a day before or after. Full-week early–late swaps are clean; a full-week swap involving nights stretches someone’s night run to two weeks. In the example month all 6 single-day requests should have raised a warning, and 1 of the 3 full-week swaps, because of the night run.
Suggested flow: both people open the request, the supervisor approves, and a failed check needs a documented exception. Approval publishes a new plan version, and the noticeboard shows that version.
## Pushed by swaps, not by line count: when should you leave the spreadsheet?
What decides is how many decisions touch the plan after publication. If one planner publishes weekly and rare swaps all go through that planner, the sheet works for four lines.
If your HR or attendance software’s shift module covers skills, rest and swap approval, do not build a second system.
Count in your own data: last month’s swap requests, how many reached the file after the swap day, and shifts without a setter.
| Route | When | Limit |
| --- | --- | --- |
| Fixed pattern + printout | One shift or fixed crews | Skills and rest checked by hand |
| Rota sheet + check rows | One planner, few swaps | Verbally approved swaps miss the file |
| Shift module of HR/attendance software | Covers your skill and rest rules | Test it against your rotation |
| Web application to be built | Many supervisors, frequent swaps, several crews | Rules must first be agreed in writing |
## Drafts, swaps and the noticeboard in the application to be built
The functions below could be built; they can be set up to fit your needs, and the scope is agreed in writing in the first step.
- **Separate draft and published plans:** a new week could open from the rotation rule, not a copy, with every check run before publication. The example’s copied row would stop there.
- **Skill-aware spare suggestions:** an available spare with the same skill could be suggested first; in the example 13 gaps drop to 2, and those 2 show as open shifts. The supervisor makes the assignment.
- **Leave and absence:** approved leave could come from leave records; an entered absence could recalculate the line-shift. The rota could show only “absent”, never the reason.
- **Swap requests:** the other party could accept, the supervisor see the check results and approval publish a new version; the example’s 6 single-day swaps would have been flagged.
- **Versions and noticeboard:** each employee could see their own rota and the current version; the printout could carry a version number and publication time. Who changed what and when could be kept as in [record change history](https://oguzerol.com/en/record-change-history/).
- **Hours:** weekly hours, night-period extensions and the annual total per person could be shown; the payroll file layout is agreed with your accountant.
AI can tell a supervisor which line-shift is thin on skills next week, or which check a swap failed. Only the crews and counts within that supervisor’s access reach the model; the supervisor decides.
The server can be opened in your company’s name; all rota and swap records are yours and can be exported as Excel or CSV at any time. For small and mid-sized teams there is no per-user licence; the running cost is the server and maintenance. The source code sits in a repository you can access, with run instructions, a dependency list and known limits.
The first meeting is paid. Prepare your shift times, your skills list and last month’s swap requests, and write to me through the [contact page](https://oguzerol.com/en/contact/).
## Points I have not verified
- I did not run the formulas in Excel; a script imitates their logic. Wildcard and range-size behaviour is from Microsoft’s page; relative references in conditional formatting are untested.
- “A single-day swap breaks 11 hours’ rest for at least one person” holds only for the example pattern: three 8-hour shifts, weekly forward rotation, Sunday off. Recalculate for other hours.
- I assumed a Sunday rest day does not break a night run; how “working week” applies to your pattern is a question for your lawyer. In Turkey, I did not read the working-time regulation referred to in Article 63. I read “second working week after” as the week right after the night week and a one-day swap as a change of shift under Article 69: interpretations, so the check is a warning, not a ruling. An extension day is 7.5 + 4 = 11.5 hours; I did not check the daily maximum or the Article 68 break.
- I give no ruling on overtime pay, time off in lieu, averaging or how an extension into the night period is classified.
## Frequently Asked Questions
### Can the same checks work for 12-hour shifts?
Yes; the cell codes and COUNTIFS rows stay, but the forbidden pairs and the night threshold are rederived from your own times. Ask your lawyer how a 12-hour night fits a night cap such as Turkey’s 7.5 hours.
### How do you keep setter qualifications current on the rota?
A qualification comes with a date: column D becomes “Yes” with the training date beside it. For expiring certificates keep the end date; an expired “Yes” does not drop off, so the formula keeps counting that person. In the application, an expired qualification is removed from spare suggestions.
### Does the application build the rota by itself?
Not necessarily. A first version can open each new week from the rotation rule and check manual changes. A solver that builds the whole rota from constraints is a separate scope.
[Back to top ↑](https://oguzerol.com/en/shift-scheduling-web-app/#icerik)
WHAT YOU CAN ASK FOR
## How do I work? Work-hour packages
Tell me about your business and what you need on WhatsApp or by phone; we agree on **a work block of somewhere between 5 and 40 hours** and I start doing what is needed. What you get is not a calendar window: it is net working hours spent directly on your business. I can use 40 hours working three days straight, or deliberately spread it out and finish it over a year: whatever the work calls for. I do not spend my time estimating how long something will take, I spend it doing the work; every hour I spend leaves a lasting result in your business. We keep going for as long as you find it useful.
WORK BLOCKS
## Why not monthly? Does a 40-hour block mean one week?
On a fixed monthly fee both sides are watching the wrong thing: you watch a fixed cost, the other side watches how many more contracts like this they can line up. Working by the hour puts us both in front of the same thing: the real value of the work that got done. I know not having an upfront answer to "how much will this cost in total?" is the natural cost of this model. But instead of paying a fixed fee for months to a setup that is not producing results, you only pay for the qualified time spent on your work: and you see exactly where that time went, start to finish. That is why my clients keep coming back.
- **5 hours**: **300 € + VAT** (60€ per hour) · [Choose this block](https://wa.me/905496546489?text=Hi%2C%20I%27d%20like%20info%20about%20the%205-hour%20work%20block.)
- **10 hours**: **500 € + VAT** (50€ per hour) · [Choose this block](https://wa.me/905496546489?text=Hi%2C%20I%27d%20like%20info%20about%20the%2010-hour%20work%20block.)
- **20 hours**: **800 € + VAT** (40€ per hour) · [Choose this block](https://wa.me/905496546489?text=Hi%2C%20I%27d%20like%20info%20about%20the%2020-hour%20work%20block.)
- **40 hours**: **1,400 € + VAT** (35€ per hour) · [Choose this block](https://wa.me/905496546489?text=Hi%2C%20I%27d%20like%20info%20about%20the%2040-hour%20work%20block.)