← All how-to recipes

How to calculate overtime pay

✓ Verified in LibreOffice 25.8.7.3 ✓ Verified in Google Sheets (2026-08-30)

Split hours into regular and overtime at 1.5x past 40 — payroll's most common formula.

The formula

AppFormulaNotes
Excel (desktop)=MIN(A2,40)*B2+MAX(0,A2-40)*B2*1.5A2=total hours, B2=hourly rate. Change 40 and 1.5 to your rules.
Google Sheets=MIN(A2,40)*B2+MAX(0,A2-40)*B2*1.5Identical.
LibreOffice Calc=MIN(A2,40)*B2+MAX(0,A2-40)*B2*1.5Identical.

How it works

MIN caps the regular hours at 40 and MAX floors the overtime at zero, so the pair works for both sides of the threshold: 45 hours at $20 is 40×20 + 5×30 = $950, and a 35-hour week is simply 35×20 with no negative overtime. The same MIN/MAX pattern handles any tiered rate — double time past 60 just adds another MAX term.

Verified, not just documented

We ran =MIN(A2,40)*B2+MAX(0,A2-40)*B2*1.5 in LibreOffice 25.8.7.3 (headless, with forced recalculation) and it returned 950 — exactly the expected result. We then ran the same formulas in Google Sheets, executed 2026-08-30: a formula-only workbook goes into Google Drive, which converts it to a Sheet and recalculates every formula with Google’s own engine, and comes back out as .xlsx carrying the values Google computed. It returned 950 for the worked example, the same value LibreOffice produced. Both engines’ numbers on this page are executed results. The Excel formula follows Microsoft’s official documented syntax — we do not run desktop Excel.

Functions used

MIN · MAX — see full Excel, Google Sheets & LibreOffice compatibility for each.

Related recipes

Related comparisons