How to calculate overtime hours over 8 hours a day in Excel
Formula (Excel and Google Sheets)
=MAX(0,(C2-B2)*24-$G$1)Take the hours worked minus 8, but never below zero: =MAX(0,(C2-B2)*24-$G$1), with 8 in G1.
- Result on the example
- one result per row in
D2, filled down toD6 - Works in
- Every current version
- Google Sheets
- Same formula
See it work
The formula is already in D2, filled down to D6. Change any input and the result updates, or edit the formula to experiment.
How it works
(C2-B2)*24 is the hours worked that day. Subtracting the 8 regular hours in G1 leaves the overtime, and MAX(0, …) turns short days into 0 instead of negative overtime. Tuesday, 7:00 AM to 6:15 PM, is 11.25 hours, so 3.25 hours of overtime.
=MAX(0,(C2-B2)*24-$G$1)Result0.5
C23:30 PMThe value in C2.
B27:00 AMThe value in B2.
C2-B20.3541666667The - operator subtracts.
C2-B2)*248.5The * operator multiplies.
$G$18The value in G1.
C2-B2)*24-$G$10.5The - operator subtracts.
MAX(0,(C2-B2)*24-$G$1)0.5MAX: Largest number.- number1
0 - number2
C2-B2)*24-$G$10.5
- number1
In Google Sheets
The same formula works in Google Sheets: =MAX(0,(C2-B2)*24-$G$1). We ran it in Google Sheets mode on the same data and it returns the same results.
Other ways to do it
Each one was run on the same example sheet.
| Formula | Result | When to use it |
|---|---|---|
| =MAX(0,(C2-B2)*24-8) | 0.50, 3.25, 0.00… | With the 8 typed in. A cell is easier to change. |
| =MIN((C2-B2)*24,$G$1) | 8.00, 8.00, 6.00…Different result | The regular hours instead, capped at 8. Regular hours, not overtime. |
Common mistakes
- Overtime rules differ. US federal law counts overtime per week, over 40 hours; some states, such as California, also count it per day over 8.
- Subtract unpaid breaks before comparing with 8.
Try it yourself
Same data, empty answer cell. Your formula is graded instantly, then re-checked on changed data, so a typed-in number won't pass.
Calculate overtime hours over 8 hours a day
D2, calculate the hours worked beyond the regular hours in G1, showing 0 for shorter days. Fill down to D6.Questions
How do I calculate weekly overtime over 40 hours?
=MAX(0,SUM(hours)-40).
How do I get the regular hours?
=MIN((C2-B2)*24,$G$1).
Checked by running on 2026-10-30: every formula and result on this page was calculated by the Spreadsheet Practice formula engine, in both Excel and Google Sheets modes.