Excel shift rota: the formulas that keep a staff schedule honest
A staff rota looks trivial until someone swaps a shift, someone goes sick, and the hours stop adding up. Then you rebuild the whole thing by hand at 11pm. These are the formulas I use in a small team rota so the sheet keeps itself honest. Everything works in Excel and in Google Sheets with the same syntax. 1. One row per person, one column per day Keep the grid boring: Column A: staff name…
Creating a staff rota can be a simple task until something goes wrong, like a shift swap or a staff member calling in sick. To keep the schedule accurate, I used these formulas in Excel and Google Sheets. First, allocate one row per person and one column per day. Column A holds the staff names, while columns B to H contain the days from Monday to Sunday.
Fill in the real dates in row 1, starting with the Monday date in cell B1. Then, in cell C1, use the formula "=B1+1" and drag it across to fill the remaining days. Real dates are crucial because every subsequent formula refers to them.
Next, use short codes for shift times: M for morning, L for late, N for night, and OFF for a day off. Count shifts per person in the week using these formulas: =COUNTIF(B2:H2,"M") for morning shifts, =COUNTIF(B2:H2,"L")+COUNTIF(B2:H2,"N") for late and night shifts. For a more streamlined approach, use named ranges and the SUMPRODUCT formula: =SUMPRODUCT(--(B2:H2={"M","L","N"})).
To flag anyone working six days in a row, which often leads to mistakes, count the longest run of non-OFF cells in a row with the formula: =MAX(FREQUENCY(IF(B2:H2 "OFF",COLUMN(B2:H2)),IF(B2:H2="OFF",COLUMN(B2:H2)))). In Excel 365 and Google Sheets, enter this formula normally. In older Excel versions, confirm it with Ctrl+Shift+Enter. Use conditional formatting to flag entire sheets at once with the same formula: =MAX(FREQUENCY(IF($B2:$H2 "OFF",COLUMN($B2:$H2)),IF($B2:$H2="OFF",COLUMN($B2:$H2)))).
The second problem addressed by these formulas is identifying days with no coverage when no one is on late shifts. In the summary block under the grid, use =COUNTIF(B$2:B$20,"L") to count the number of late shifts per day. With just one column per day and one row per code, you can quickly see that Thursday has no one on nights.
Once you have the shift codes, you can turn them into hours using a lookup table with the SUMPRODUCT formula: =SUMPRODUCT(COUNTIF(B2:H2,$K$2:$K$5),$L$2:$L$5). This gives you the total scheduled hours for a person without manual entries. To handle shift swaps without losing the original information, add a note column to log the date, the two people involved, and who approved the swap.
Finally, lock the formula cells before sharing the file to prevent accidental overwriting. Protect the sheet, allowing only edits to the shift grid. This simple process prevents the common issue of users manually changing formulas, resulting in "the rota is broken" complaints. Finished rota templates cost about twenty minutes to build and can be reused every week.
I keep a finished version as an Excel template, which includes the coverage block, hours lookup, and over-five-days flag. The template is available for purchase at $6: https://youssef1818.gumroad.com/l/shift-rota. For businesses running multiple teams, the same formulas can be found in the Small Business Starter Kit, which bundles the rota with other essential sheets like cash flow, quoting, inventory, CRM, and profit and loss sheets: https://youssef1818.gumroad.com/l/small-business-kit.
Rewritten by urgent.news; may contain errors — check the original.
Source: dev.to