Skip to content
7 min read

Google Sheets timesheet: calculate overnight shift hours

Calculate a 10 p.m.–6 a.m. shift in Google Sheets without a negative result, know when MOD is enough, and use explicit date-time values when dates matter.

Illustrative overnight-shift timeline from 22:00 through midnight to 06:00, subtracting a 30-minute break for a 7.5-hour result

Imagine a hypothetical timesheet row used only for explanation: work starts at 10 p.m. (22:00), ends the next morning at 6 a.m. (06:00), and has a 30-minute break. When B2 contains 22:00, C2 contains 06:00, D2 contains 30, and the shift is under 24 hours, =MOD(C2-B2,1)*24-D2/60 returns 7.5 decimal hours.

CellMeaningFictional value
B2Start clock time22:00
C2End clock time06:00
D2Break minutes30
E2Calculated decimal hours7.5

The row is invented for explanation, not a worker, customer, or real timesheet. Here 7.5 decimal hours means 7 hours 30 minutes.

Why does 6:00 minus 22:00 go negative?

Google Sheets stores a time-only value as a fraction of one day. In this example, 22:00 is about 0.9167 of a day and 06:00 is 0.25 of a day. Plain C2-B2 subtraction therefore moves backward by 16 hours within the same day; after subtracting the 30-minute break, the naive result is -16.5 hours.

MOD turns that negative time difference into the matching positive position in a 24-hour cycle. The difference of -0.6667 days becomes 0.3333 days, which is 8 hours. Subtracting 30 minutes as D2/60 gives 7.5 hours. Google’s official MOD function help is https://support.google.com/docs/answer/3093497?hl=en.

Use this formula only for shifts known to be under 24 hours:

=MOD(C2-B2,1)*24-D2/60

Put the start clock time in B2, the end clock time in C2, break minutes in D2, and this formula in E2. Format E2 as a number, not as a time of day, because the result is decimal hours.

The limitation is important: a time-only formula treats any earlier end time as an overnight end time. It has no date information, so it cannot detect a mistyped date. It also cannot distinguish an 8-hour shift from a 32-hour span because both leave the same position in a 24-hour cycle.

Diagram comparing clock-only input, limited to shifts under 24 hours and calculated with MOD, with explicit start and end date-times calculated by direct subtraction. A warning notes that clock-only input cannot catch a wrong date.

Planning diagram, not a spreadsheet screen or tested product. Path A uses clock times only for shifts under 24 hours; path B stores explicit start and end date-times so the actual dates participate in the calculation. Open the full-size diagram.

Which input method fits the timesheet?

Practical questionClock-only B2 and C2Explicit date-time B2 and C2
What is stored?A time fraction within one dayA date and time serial value
How is midnight handled?An earlier end time is treated as overnightThe entered end date determines elapsed time
Shift-length limitUse only under 24 hoursArithmetic can measure longer spans; review unusual durations
Wrong-date detectionNot possible from the time cellsMissing or reversed date-times can be flagged
Reasonable useSimple recurring shifts with reviewed inputRecords that need exact dates, longer spans, or easier review

Neither input method makes the entries correct by itself. The choice determines what the arithmetic can know. If the date matters to the record, put the date in the same value as the time rather than keeping it in a separate note.

When should you use explicit start and end date-times?

Use actual start and end date-time values when a record needs an explicit date, when a span could exceed 24 hours, or when a reviewer needs to catch missing and reversed entries. The values must be real spreadsheet date-time values, not plain text that only looks like a date.

With the same cell layout — start in B2, end in C2, break minutes in D2, calculated hours in E2 — use direct subtraction:

=(C2-B2)*24-D2/60

In the fictional example, B2 is 2026-11-30 22:00, C2 is 2026-12-01 06:00, and D2 is 30. The elapsed span is 8 hours; subtracting a 0.5-hour break produces 7.5 hours.

The following weekly illustration uses rows 2–8, with calculated hours in column E. Rows 4 and 8 are intentionally blank because the fictional schedule has no shift there.

RowB: start date-timeC: end date-timeD: break minutesE: calculated hours
22026-11-30 22:002026-12-01 06:00307.5
32026-12-01 22:002026-12-02 05:30307
4
52026-12-03 22:002026-12-04 06:00457.25
62026-12-04 22:002026-12-05 05:00306.5
72026-12-05 23:002026-12-06 06:00306.5
8

These dates, times, and breaks are invented teaching values. A real sheet should use the date-time format and input method of its own locale and spreadsheet settings.

How do you total the week in decimal hours?

If rows 2–8 are the week’s records and column E holds the calculated decimal hours, put the weekly total where the team expects it — for example, E9 — with:

=SUM(E2:E8)

In the fictional illustration, the populated cells are 7.5, 7, 7.25, 6.5, and 6.5, so the total is 34.75 decimal hours. That is 34 hours 45 minutes, not 34 hours 75 minutes.

This is only arithmetic over the rows present in E2:E8. It does not prove that the shifts happened, that the breaks were taken, or that the total is the correct payable time.

How can you flag problem entries for review?

For rows that use explicit date-times, an optional review cell such as F2 can catch three common input problems before anyone reads the hours:

=IF(OR(B2="",C2=""),"REVIEW MISSING",IF(C2<=B2,"REVIEW ORDER",IF(OR(D2<0,D2>(C2-B2)*24*60),"REVIEW BREAK","OK")))

The first branch marks a missing start or end as REVIEW MISSING. The second marks an end that is not after the start as REVIEW ORDER; this is where a reversed or mistyped date can become visible. The third marks a negative break, or a break longer than the elapsed span, as REVIEW BREAK. Otherwise it returns OK.

Treat the label as a review prompt, not proof. A row can be arithmetic-valid and still wrong: an end date one day too late may look valid if the resulting long span is plausible enough to pass the team’s checks. Do not use the calculated hours from a row marked for review until a person corrects or accepts the entry.

This date-time check should not be applied to the clock-only MOD setup, where an end clock time earlier than the start is the expected overnight pattern.

When is a mobile app worth scoping?

A shared spreadsheet can be a reasonable system when the people involved can enter accurate date-times and review exceptions in the same table. Nothing about the overnight calculation makes the spreadsheet inherently unsafe or inadequate.

A mobile app becomes worth scoping only when capture or review needs differ: for example, a person on a phone needs a guided start/end entry, a reviewer needs a smaller exception queue, or different roles need different record views. In that case, workflow automation may help connect the agreed review steps, while a mobile app may be one way to shape phone-side capture. Those are scoping options, not features the formulas already provide.

What does this calculation not decide?

The arithmetic does not determine payroll, overtime, wage, break entitlement, or local compliance rules. It does not know which minutes are payable, whether a break is required or unpaid, how overtime is defined, or which jurisdiction applies. Those decisions need the organization’s rules, qualified local advice where appropriate, and human review.

Google Sheets represents date and time values as serial numbers based on the spreadsheet’s time zone, and those serials do not store a time-zone offset. If a shift crosses a daylight-saving change or its times come from another zone, decide whether you need a wall-clock difference or actual elapsed time before relying on direct subtraction (Google’s date and number format notes).

For this guide, the displayed arithmetic formulas were evaluated locally in HyperFormula 3.5.0 against the stated fictional cell values. The checks produced 7.5 hours for both overnight examples, 34.75 hours for the weekly total, and the expected review labels for missing, reversed, and excessive-break cases. This was not a live Google Sheets test. No live spreadsheet, Google account, payroll system, worker record, or customer workflow was opened or tested.

For adjacent spreadsheet workflows, read how to decide between a shared Sheet and a web app and how to keep shift handovers visible.

If you want help shaping the workflow, send a sanitized sample schedule or a short workflow description. Remove worker names, business names, exact locations, customer identifiers, private notes, and account details; keep only the fields, example times, break rules, and review questions you want to examine.

Frequently asked questions

Why does 6 a.m. minus 10 p.m. go negative in Google Sheets?
Time-only cells are fractions of one day. When the end clock time is earlier than the start clock time, plain subtraction moves backward within the same day. MOD can wrap a shift under 24 hours, but it does not know the actual dates.
Can MOD handle a shift longer than 24 hours?
No. MOD returns the remainder within a 24-hour cycle, so it cannot represent the full elapsed time of a shift that lasts 24 hours or longer. Use real start and end date-time values instead.
Does this worksheet calculate payroll or overtime?
No. It only calculates elapsed decimal hours from entered values. Payroll, overtime, wages, breaks, and local compliance rules require separate decisions and review.