Ghost Sheet

Hours worked when a shift crosses midnight

How do I calculate hours between two times when the shift ends after midnight?

This is the task for this topic. It is part of the plan; the level check before it is free.
E2Type a formula for E2, starting with =

Click the sheet or the button: the task opens in your workspace, ready to type

ABCDE
1NameDateInOutHours
2Zoe Marsh11/19/20267:3015:30
3Ravi Menon11/18/20268:0016:30
4Maya Singh11/16/20266:0014:00
5Iris Lund11/17/20266:3014:00
6Caleb Ford11/27/20267:3013:30
7Eli Brooks11/19/20268:0016:30
8Tess Moore11/25/20266:3014:00
9Caleb Ford11/19/20267:3016:00
10Maya Singh11/27/20266:0012:00
11Owen Reyes11/25/20268:0015:30
12Raj Patel11/24/20267:3015:00
13
14
15
16
17
dashed: the answer to reachblack: matchesblue: right after new datared: wrong

Why it works

What it does
Times are parts of a day, so clock-out minus clock-in times 24 gives hours. When the shift ends after midnight, the difference goes negative. MOD(difference, 1) wraps it round to the time left in the day, which is the length of the shift.
The shape of the formula
=MOD(time out - time in, 1) * 24
How to remember it
Negative hours mean midnight was crossed: wrap them with MOD.
The usual mistake
Subtracting the times and multiplying by 24. Night shifts come out as minus 16 hours.

Keep practicing

Updated