Calculation Issues

Calculate Elapsed Time and Breaks in Excel with MOD

Phi Hung VoPhi Hung Vo Nov 14, 2026 869 views

Question details

Calculate elapsed hours across midnight and subtract a break entered in a separate cell.

Product
Microsoft Excel
Device & OS
not provided
Scenario
A worksheet records a start time, an end time, and a break duration in decimal hours.
Observed behavior
The desired result is the elapsed time in decimal hours, minus the break, even when the shift ends after midnight.
Before you start

Check that F3 contains the start time, E3 contains the end time, and G3 contains the break in decimal hours. Format E3 and F3 as Time, and enter times with a space before AM or PM, such as 10:15 PM.

Solution 1Recommended

Use MOD to Calculate Hours Across Midnight and Subtract a Break

Use this formula for a shift shorter than 24 hours when the break is recorded as decimal hours.

MOD adjusts the time difference when the end time is after midnight. Multiplying by 24 converts Excel's fraction of a day to hours, so the break can be subtracted in decimal hours.

1
Enter the shift times

In Excel, enter the start time in F3 and the end time in E3, for example, 10:15 PM and 4:20 AM. Select both cells and choose a Time format from the Home tab's Number format menu.

2
Enter the break

In G3, enter the break as decimal hours. For example, enter 1.25 for a 1-hour, 15-minute break.

3
Calculate the net hours

Select an empty result cell, enter =MOD(E3-F3,1)*24-G3, and press Enter.

4
Format the result

Select the result cell and choose Number from the Home tab's Number format menu. Adjust the displayed decimal places if needed.

Shift length limit: Time-only values do not identify shifts of 24 hours or longer. Include dates in the start and end cells to calculate those durations.
Calculate work hours in WPS

Calculate Overnight Work Hours in WPS Spreadsheet

Use the same MOD formula in WPS Spreadsheet to calculate hours across midnight and subtract a break in decimal hours.

  1. 1. Open the worksheet: Open WPS Spreadsheet and select Open to choose your workbook, or create a new spreadsheet.
  2. 2. Enter the times and break: Enter the start time in F3, the end time in E3, and the break in decimal hours in G3. For example, enter 1.25 for a 1-hour, 15-minute break.
  3. 3. Apply the formula: Select an empty cell, enter =MOD(E3-F3,1)*24-G3, and press Enter.
  4. 4. Format the result: Select the result cell and use the Home tab's Number format menu to display it as a number with the desired decimal places.
Calculate overnight elapsed hours with MODOpen and edit Microsoft Excel XLSX and XLS filesFormat results as decimal hoursUse familiar spreadsheet formulas and menus
microsoft office alternative - wps office

Frequently Asked Questions

Why does the formula use MOD?

MOD(E3-F3,1) returns the time difference within a day, including when the end time in E3 is after midnight and appears earlier than the start time in F3.

How do I enter a 30-minute break?

Enter 0.5 in G3. The formula expects the break in decimal hours, not minutes.

What if my break is entered as a time value?

If G3 contains a duration such as 1:15 rather than 1.25, use =MOD(E3-F3,1)*24-G3*24 to convert the break to decimal hours before subtracting it.

Why isn't Excel calculating my entered times?

Check that E3 and F3 contain recognized time values rather than text. Reenter them with a space before AM or PM, such as 10:15 PM, and select Time from the Home tab's Number format menu.

Can this formula calculate a shift longer than 24 hours?

Not reliably with time-only entries. Enter both dates and times in F3 and E3, then use =(E3-F3)*24-G3 to calculate the full duration in decimal hours.