Excel guide · 5 min read
How to calculate hours per week from a timesheet in Excel
=A2-WEEKDAY(A2,2)+1 so every shift gets the Monday of its week, then total each person's week with =SUMIFS($F$2:$F$13,$B$2:$B$13,I2,$G$2:$G$13,J2). Format the totals as [h]:mm, or multiply by 24 for decimal hours, and compare with the overtime threshold as K2*24>40, not K2>40.Sample data
Every result on this page was calculated from this sheet by the same spreadsheet engine the Cellwise app uses.
| A | B | C | D | E | F | G | H | I | J | K | L | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | Date | Employee | In | Out | Break | Hours | Week of | Employee | Week of | Hours | Overtime (h) | |
| 2 | Oct 19, 2026 | Ana Ruiz | 6:00 | 18:00 | 0:30 | 11:30 | Oct 19, 2026 | Ana Ruiz | Oct 19, 2026 | 1.9375 | 6.5 | |
| 3 | Oct 19, 2026 | Ben Okoro | 14:00 | 22:30 | 0:30 | 8:00 | Oct 19, 2026 | Ben Okoro | Oct 19, 2026 | 1 | 0 | |
| 4 | Oct 20, 2026 | Ana Ruiz | 6:00 | 18:00 | 0:30 | 11:30 | Oct 19, 2026 | Ana Ruiz | Oct 26, 2026 | 0.8125 | 0 | |
| 5 | Oct 21, 2026 | Ben Okoro | 14:00 | 22:30 | 0:30 | 8:00 | Oct 19, 2026 | Ben Okoro | Oct 26, 2026 | 1.0208333333 | 0 | |
| 6 | Oct 22, 2026 | Ana Ruiz | 6:00 | 18:30 | 0:30 | 12:00 | Oct 19, 2026 | |||||
| 7 | Oct 24, 2026 | Ana Ruiz | 6:00 | 18:00 | 0:30 | 11:30 | Oct 19, 2026 | |||||
| 8 | Oct 25, 2026 | Ben Okoro | 22:00 | 6:30 | 0:30 | 8:00 | Oct 19, 2026 | |||||
| 9 | Oct 26, 2026 | Ana Ruiz | 6:00 | 18:00 | 0:30 | 11:30 | Oct 26, 2026 | |||||
| 10 | Oct 27, 2026 | Ben Okoro | 14:00 | 23:15 | 0:45 | 8:30 | Oct 26, 2026 | |||||
| 11 | Oct 28, 2026 | Ana Ruiz | 6:00 | 14:30 | 0:30 | 8:00 | Oct 26, 2026 | |||||
| 12 | Oct 29, 2026 | Ben Okoro | 14:00 | 22:30 | 0:30 | 8:00 | Oct 26, 2026 | |||||
| 13 | Oct 30, 2026 | Ben Okoro | 14:00 | 22:30 | 0:30 | 8:00 | Oct 26, 2026 |
Download this sheet as an Excel practice file (.xlsx)
Step 1: hours for each shift
The log has one row per shift: date, employee, clock-in, clock-out and unpaid break, all typed as real times like 6:00 and 0:30. Excel stores a time as a fraction of a day, so 11:30 is 0.479. Every total below is in those day fractions until you multiply by 24.
Out minus in minus break works for day shifts. Ben's Sunday night shift on row 8 starts at 22:00 and ends at 6:30, so D8-C8-E8 gives -0.67 of a day, which a time format shows as ####. MOD(...,1) wraps a negative difference round the clock, so the same formula handles both. It assumes no shift runs 24 hours or longer.
Result: 8:00 shows as 8:00 with the custom h:mm format
8:00 for Ben's overnight shift: 8.5 hours on the clock minus a 30-minute break. Column F uses this formula on every row.
Step 2: a week key for every shift
To group by week, every row needs the same label for the same week. A real date for the week start works best: =A2-WEEKDAY(A2,2)+1 returns the Monday on or before each date, because WEEKDAY with 2 numbers Monday as 1 and Sunday as 7. Format column G as a date.
Use your payroll week, not the calendar's. If your week runs Sunday to Saturday, use =A2-WEEKDAY(A2)+1; for a Saturday start, =A2-WEEKDAY(A2,16)+1.
An overnight shift belongs to the date it starts on. Ben's shift starting Sunday October 25 counts in the week of October 19 even though it ends on Monday. If your rules split hours at midnight, that needs two rows.
Result: Oct 19, 2026 shows as Mon 19 Oct 2026 with the custom ddd d mmm yyyy format
Mon 19 Oct 2026: the Sunday night shift is keyed to the week that started on Monday the 19th.
Step 3: total each person's week with SUMIFS
Build a small summary table: employee in I, week start in J, then SUMIFS adds the hours where both the name and the week match. Lock the log ranges with $ and leave I2 and J2 relative so you can fill down.
The week starts in J must be real dates equal to the ones in column G. A typed label like "Oct 19" matches nothing and the total is 0. Excel 365 users can build the two key columns with =UNIQUE(B2:B13) and the week dates, or skip the summary layout and use a PivotTable (below).
Prefer no helper column? Replace the week test with a date range: =SUMIFS($F$2:$F$13,$B$2:$B$13,I2,$A$2:$A$13,">="&J2,$A$2:$A$13,"<"&J2+7) gives the same 46:30.
Result: 1.9375 shows as 46:30 with the custom [h]:mm format
46:30 for Ana in the week of October 19: 11:30 + 11:30 + 12:00 + 11:30. Ben's week is 24:00, and the next week is 19:30 for Ana and 24:30 for Ben.
Why the total shows 22:30: format as [h]:mm
Ana's 46.5 hours is 1.9375 days. With an h:mm format, Excel shows only the hours left after removing whole days, so the cell reads 22:30. It is the display that is wrong, not the value.
Select the totals and press Ctrl+1, choose Custom and type [h]:mm. The square brackets let the hours run past 24. Do the same for any grand total.
Result: 22:30
22:30: what Ana's 46.5-hour week looks like without the brackets.
Step 4: decimal hours and overtime
Payroll and invoices need decimal hours. Multiply the time total by 24: =ROUND(K2*24,2) gives 46.5. Round at this step, after summing, so rounding differences do not pile up shift by shift.
Put the overtime threshold in an input cell (N2 holds 40 here as an example) because the rules depend on your contract and location. Then compare in the same unit. The trap: K2>N2 is FALSE for Ana, since 1.9375 days is never more than 40. Either convert the total to hours (K2*24) or the threshold to days (N2/24).
If overtime also applies per day, work it out on each shift row first and keep it out of the weekly figure, so the same hours are not paid twice.
Result: 6.5
6.5 overtime hours for Ana in the week of October 19. The other three person-weeks return 0.
No formulas: a PivotTable
If you only need the totals, a PivotTable builds the person-by-week grid for you and picks up new names automatically when you refresh. It still needs the Week of column, since the shift dates themselves would give one column per day.
- Click inside the log and choose Insert > PivotTable, then OK.
- Drag Employee to Rows, Week of to Columns and Hours to Values.
- Click the Sum of Hours field, choose Value Field Settings > Number Format > Custom and type [h]:mm.
- After adding shifts, use PivotTable Analyze > Refresh. Turning the log into a table first (Ctrl+T) makes new rows part of the source.
Common mistakes
Totals show 22:30 instead of 46:30
Use the custom format [h]:mm on totals. Plain h:mm drops whole days.
Overtime check never triggers
Times are fractions of a day, so compare K2*24 with 40, or K2 with 40/24.
Weekly total is 0
Usually the week key in the summary is text or a different weekday than column G, or the times were imported as text, which SUMIFS skips. Check with ISNUMBER on the cells.
Night shift shows ####
Out minus in is negative when a shift crosses midnight. Use MOD(out-in,1).
FAQ
How do I calculate total hours per week in Excel?
Give each shift a week-start date with =A2-WEEKDAY(A2,2)+1, then SUMIFS the hours by employee and week. Format the result as [h]:mm, or multiply by 24 for decimal hours.
How do I sum hours by employee and week?
Use SUMIFS with two criteria: =SUMIFS(hours,employee_col,name,week_col,week_start). A PivotTable with Employee in rows and Week of in columns gives the same grid without formulas.
Why does my weekly hours total reset after 24 hours?
The cell is formatted h:mm, which shows only the part of a day left over. Change the format to [h]:mm and the total shows every hour.
How do I calculate overtime over 40 hours a week in Excel?
With the weekly total in K2 and the threshold in N2, use =MAX(0,K2*24-N2). Keep the threshold in a cell, since overtime rules vary by employer and location.
Which week does an overnight shift count in?
With the week key built from the start date, the whole shift counts in the week it starts. That matches many payroll systems, but check your own rules; if hours must split at midnight, log the shift as two rows.
Functions used
SUMIFSAdds with several conditionsWEEKDAYDay of the week as a numberMODRemainder after divisionMAXLargest numberROUNDRounds to digitsTEXTNumber to formatted textUNIQUERemoves duplicates, spills
Related guides
- How to calculate hours worked (and overtime) in Excel
- How to sum by week in Excel
- How to sum time in Excel
- Calculate hours worked overnight in Excel
- Excel formulas cheat sheet: the 25 everyone should know
- How to remove the time from a date in Excel
Updated