Calculate Hours Worked and Overtime in Excel
By ExcelReady TeamUpdated 6 min read
The short answer
To calculate overtime in Excel, first get hours worked: =(End-Start)*24 turns a time difference into decimal hours. Total the week with SUM, then use =MAX(0,Total-40) or =IF(Total>40,Total-40,0) for overtime hours. Pay is regular hours times the rate plus overtime hours times the rate times 1.5, rounded to cents with ROUND.
Key takeaways
- Excel stores a time as part of a day, so multiply a time difference by 24 to get hours as a number.
- Subtract unpaid breaks in hours: minutes divided by 60.
- =MOD(End-Start,1)*24 handles shifts that end after midnight.
- Overtime hours are =MAX(0,Total-40); regular hours are =MIN(Total,40).
- Overtime rules depend on your law and contract; 40 hours at 1.5× is only an example.
On this page+
To calculate overtime in Excel, you first turn start and end times into hours worked, total the week, and then use IF (or MAX) to split the total into regular hours and overtime. A final ROUND keeps the pay to exact cents. This guide builds a one-week timesheet for one employee and a pay summary for a team. It is for supervisors, payroll and HR staff, and anyone checking their own hours.
How Excel stores time#
Excel stores a time as a fraction of a day. 12:00 noon is 0.5, 6:00 AM is 0.25, and one hour is 1/24. That is why subtracting two times gives a small decimal, not hours.
| Time | What Excel stores |
|---|---|
| 6:00 | 0.25 |
| 12:00 | 0.5 |
| 18:00 | 0.75 |
| 8 hours 45 minutes | 0.364583… |
Multiply by 24 to turn a time difference into decimal hours: 0.364583 × 24 = 8.75. Decimal hours are easy to add, compare with 40 and multiply by a pay rate. Dates work the same way, with whole numbers for days, as explained in why Excel stores dates as numbers.
Step 1: Set up the timesheet#
Enter one row per day with the start time, end time and unpaid break in minutes. Type times with a colon, such as 8:30 or 17:15; Excel recognises them as times.
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Day | Start | End | Break (min) | Hours |
| 2 | Mon | 8:30 | 17:15 | 30 | 8.25 |
| 3 | Tue | 8:00 | 18:30 | 45 | 9.75 |
| 4 | Wed | 9:00 | 17:30 | 30 | 8.00 |
| 5 | Thu | 7:45 | 18:00 | 30 | 9.75 |
| 6 | Fri | 8:00 | 16:30 | 30 | 8.00 |
| 7 | Total | 43.75 |
You can use 12-hour times too: type 5:15 PM with a space before PM. To stamp the current time into a cell, press Ctrl+Shift+; (Mac: ⌘;).
Step 2: Calculate hours worked each day#
Subtract the start from the end, multiply by 24, and take off the break. In E2:
=(C2-B2)*24-D2/60The brackets make Excel subtract before it multiplies. The break is in minutes, so dividing by 60 turns it into hours. Monday is 8.75 hours on site minus 0.5 hours of break: 8.25. Fill down to E6.
If E2 shows a time such as 6:00 instead of 8.25, the cell picked up a time format from the cells it uses. Select column E and press Ctrl+Shift+~ (Mac: Control+Shift+~) for the General format, or choose Number with two decimals.
Shifts that end after midnight#
A shift from 22:00 to 6:00 gives a negative number with plain subtraction, because 6:00 is a smaller fraction than 22:00. MOD fixes it:
=MOD(C2-B2,1)*24MOD with 1 keeps only the part of a day, so -0.6667 becomes 0.3333, which is 8 hours. The formula also works for normal day shifts, so you can use it everywhere.
Step 3: Total the week#
Add the daily hours with SUM. In E7:
=SUM(E2:E6)The week comes to 43.75 hours. If you add time values instead of decimal hours, format the total as [h]:mm (Ctrl+1 or ⌘1 > Custom). The square brackets let the hours pass 24; without them, 43:45 would show as 19:45.
Step 4: Split regular hours and overtime with IF#
Regular hours are capped at the threshold, and overtime is anything above it. With the threshold of 40 in H1:
| Cell | What it is | Formula | Result |
|---|---|---|---|
| H2 | Regular hours | =MIN(E7,$H$1) | 40.00 |
| H3 | Overtime hours | =IF(E7>$H$1,E7-$H$1,0) | 3.75 |
IF reads as: if the total is over 40, overtime is the total minus 40; otherwise it's 0. =MAX(0,E7-$H$1) gives the same result in a shorter formula. The threshold lives in its own cell, so a 38-hour or 44-hour rule needs one change. The IF function guide and the Excel IF function explained simply cover more IF patterns.
Some rules count overtime per day, for example over 8 hours in a day. Then use =MAX(0,E2-8) on each row and add those up instead.
Step 5: Calculate pay and round it#
Pay is regular hours at the normal rate plus overtime at a higher rate. With the hourly rate of 22.00 in H4 and the overtime multiplier of 1.5 in H5:
=ROUND(H2*H4+H3*H4*H5,2)That is 40 × 22.00 = 880.00, plus 3.75 × 22.00 × 1.5 = 123.75, for 1,003.75.
ROUND with 2 decimals matters with rates like 18.75. Priya, in the exercise on this page, works 43.5 hours: 40 × 18.75 + 3.5 × 18.75 × 1.5 = 848.4375. Formatting would only show 848.44; ROUND stores exactly that, so payroll totals add up. How to round numbers in Excel explains ROUND, ROUNDUP and ROUNDDOWN.
You can also write the pay as one IF formula, which is the exercise:
=ROUND(IF(B2>40,40*C2+(B2-40)*C2*1.5,B2*C2),2)Step 6: Summarise pay for a team#
For a team, put one row per employee with their weekly hours and rate, then fill the one-formula version down:
| Employee | Hours | Rate | Pay |
|---|---|---|---|
| Priya | 43.5 | 18.75 | 848.44 |
| Tom | 38 | 21.00 | 798.00 |
| Aisha | 46 | 19.50 | 955.50 |
| Mateo | 40 | 24.00 | 960.00 |
Mateo shows the boundary: exactly 40 hours is not over 40, so he gets no overtime. Check that your rule says "over 40" before you choose > rather than >=.
To bring in each person's rate automatically, look it up by employee ID from a staff list; the employee lookup sheet project builds exactly that. A weekly overtime total also makes a good line on a KPI summary sheet.
Rounding time to the nearest quarter hour#
Some workplaces round clock-in and clock-out times. On decimal hours, =ROUND(E2*4,0)/4 rounds to the nearest 0.25 hour (15 minutes): 8.2 becomes 8.25. Use ROUNDDOWN or ROUNDUP in place of ROUND if your policy always rounds one way.
Overtime rules come from local law and employment contracts, so the 40-hour threshold and 1.5× rate here are examples, not advice. Payroll work like this is part of the Excel skills for finance and accounting jobs.
Practise it#
Do the exercise on this page to work out overtime pay with IF and ROUND. Then practise the IF function, including IF that returns a calculation, and practise ROUND, ROUNDUP and ROUNDDOWN in a live spreadsheet.
Try it yourself
This is a live spreadsheet. Type the formula in the green cell and press Enter.
Overtime is paid at 1.5× the hourly rate for hours over 40 in a week. In D2, work out Priya's weekly pay with IF: if her hours in B2 are over 40, pay 40 hours at the rate in C2 plus the extra hours at 1.5 times the rate; otherwise pay hours times rate. Round the result to 2 decimals with ROUND.
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Pay | ||||
| 2 | |||||
| 3 | |||||
| 4 | |||||
| 5 | |||||
| 6 | |||||
| 7 | |||||
| 8 |
Tip: Inside ROUND(…,2), use IF(B2>40, 40*C2+(B2-40)*C2*1.5, B2*C2). Priya's pay should come to 848.44.
Practise this in a lesson
Frequently asked questions
How do I calculate hours worked between two times in Excel?
Subtract the start time from the end time and multiply by 24: =(C2-B2)*24. Excel stores times as fractions of a day, so the 24 turns the result into hours, for example 8.75 for 8 hours 45 minutes.
Why does my total show 19:45 instead of 43:45?
A normal time format restarts at 24 hours, like a clock. Format the total with the custom format [h]:mm, or convert the hours to decimal numbers with *24 before you add them.
How do I calculate time worked across midnight?
Use MOD so the difference never goes negative: =MOD(C2-B2,1)*24. A shift from 22:00 to 6:00 then gives 8 hours.
Can Excel round hours to the nearest quarter hour?
Yes. =ROUND(E2*4,0)/4 rounds decimal hours to the nearest 0.25. Use ROUNDUP or ROUNDDOWN instead of ROUND if your policy always rounds one way.
Is overtime always paid after 40 hours?
No. The threshold, the multiplier and whether overtime is counted per day or per week depend on local law and your employment contract. Put the threshold and multiplier in their own cells so you can match your rules.