Excel Formula to Subtract Lunch Breaks from Shift Hours
Question details
Calculate weekly paid hours from multiple shifts, deducting unpaid lunch breaks when a shift exceeds five hours.
- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- An employee schedule records start times, end times, and unpaid break durations for each shift.
- Observed behavior
- The weekly total should include each shift's hours and subtract its unpaid break only when the shift is longer than five hours.
Create columns for shift start time, end time, break duration, and paid hours, with one shift per row. Enter breaks as time durations, such as 0:30 for 30 minutes, rather than as decimal hours.
Calculate paid time for each shift and sum the week
Use this formula when each shift has its own start time, end time, and unpaid break duration.
The formula checks the full shift duration before deducting the break. A shift of exactly five hours does not trigger a deduction.
MOD handles a shift that ends after midnight when only times are entered. This method assumes each shift is shorter than 24 hours.
In Excel, enter start times in column B, end times in column C, and unpaid break durations in column D, beginning on row 2.
In E2, enter =IF(OR(B2="",C2=""),"",MAX(0,MOD(C2-B2,1)-IF(MOD(C2-B2,1)>TIME(5,0,0),D2,0))). The result stays blank until both shift times are entered.
Select E2 and drag its fill handle down through the remaining shift rows.
In a total cell, enter =SUM(E2:E8), adjusting the range to include all shifts for the week. Select the paid-time cells and total, open Format Cells, and choose Custom > [h]:mm.
Convert the weekly total to decimal hours
Use decimal hours when the weekly total is needed for a payroll calculation.
Calculate paid shift hours in WPS Spreadsheet
Use the same shift and break formula in WPS Spreadsheet, then sum the paid time for the week.
- 1. Open a worksheet: Open WPS Spreadsheet and create a workbook or open your existing schedule.
- 2. Enter shift details: Put start times in column B, end times in column C, and break durations in column D, starting on row 2.
- 3. Calculate paid time: In E2, enter =IF(OR(B2="",C2=""),"",MAX(0,MOD(C2-B2,1)-IF(MOD(C2-B2,1)>TIME(5,0,0),D2,0))) and drag the fill handle down for the other shifts.
- 4. Sum and format the hours: Enter =SUM(E2:E8) in a total cell, adjusting the range as needed. Use Format Cells > Custom > [h]:mm for the paid-time cells and total.

Frequently Asked Questions
Is a lunch break deducted for a shift of exactly five hours?
No. The formula uses >TIME(5,0,0), so a break is deducted only when the shift exceeds five hours. Change > to >= if your policy also requires a deduction at exactly five hours.
How do I enter a 30-minute lunch break?
Enter 0:30 in the break-duration cell in column D. The formula treats it as 30 minutes, not 30 decimal hours.
Will the formula work for an overnight shift?
Yes. MOD(C2-B2,1) handles an end time after midnight when the shift is shorter than 24 hours. Shifts of 24 hours or more require a calculation using full start and end dates and times.
Why does my weekly total show fewer than 24 hours?
The cell may be using a clock-time format that wraps after 24 hours. Select the total cell, open Format Cells, and choose Custom > [h]:mm to display accumulated hours.




