Formula Errors

Excel Formula to Calculate Timesheet Hours With a One-Hour Minimum

Olivia MillerOlivia Miller Nov 22, 2026 868 views

Question details

Calculate timesheet hours with a minimum of one hour while returning zero for incomplete entries and handling shifts that cross midnight.

Calculate Timesheet Hours in Excel With a One-Hour Minimum
Product
Microsoft Excel
Device & OS
not provided
Scenario
A timesheet has a start time in D5 and an end time in E5, with the calculated hours displayed in F5.
Observed behavior
The desired formula returns decimal hours, applies a one-hour minimum to completed entries, and returns zero if either time is blank.
Before you start

Enter valid time values in D5 and E5, and reserve F5 for the result. This formula assumes time-only entries and shifts shorter than 24 hours.

Solution 1Recommended

Calculate hours with a one-hour minimum in Excel

Use this formula to calculate decimal hours, including overnight shifts, while leaving incomplete rows at zero.

1
Select the result cell

Open your timesheet in Excel and select F5, where the calculated hours should appear.

2
Enter the formula

In F5, enter =IF(OR(E5="",D5=""),0,IF(E5<D5,MAX((E5-D5)*24+24,1),MAX((E5-D5)*24,1))) and press Enter.

3
Format the result

Select F5 and choose Home > Number > Number so the result displays as decimal hours rather than a time.

4
Apply it to other rows

Drag the fill handle from F5 down the column to copy the formula to additional timesheet rows.

Calculate hours with a one-hour minimum in Excel
Time-entry assumptions: An end time earlier than the start time is treated as the next day. Equal start and end times return one hour, not a 24-hour shift. The formula does not need to be entered as an array formula.
Work with timesheets in WPS Office

Calculate minimum timesheet hours in WPS Spreadsheet

Use the same formula in WPS Spreadsheet to calculate decimal hours, account for overnight shifts, and apply a one-hour minimum.

  1. 1. Open the timesheet: Open your Excel workbook in WPS Spreadsheet and locate the start and end time columns.
  2. 2. Enter the times: Enter the start time in D5 and the end time in E5.
  3. 3. Add the formula: Select F5, enter =IF(OR(E5="",D5=""),0,IF(E5<D5,MAX((E5-D5)*24+24,1),MAX((E5-D5)*24,1))) and press Enter.
  4. 4. Format and copy the result: Use the Home tab's number-format controls to display F5 as a number, then drag its fill handle down to apply the formula to other rows.
Calculate overnight timesheet hours with a one-hour minimumOpen and edit Microsoft Excel XLSX filesUse familiar spreadsheet formulas and formatting controls
microsoft office alternative - wps office

Frequently Asked Questions

What does the formula return if a time is missing?

If D5 or E5 is blank, the formula in F5 returns 0 instead of applying the one-hour minimum.

How does the formula handle a shift that ends after midnight?

When E5 is earlier than D5, the formula treats E5 as a time on the following day and adds 24 hours to the difference.

Why does a 30-minute shift show as one hour?

The MAX function sets the minimum result for completed entries to 1. Longer shifts return their actual duration in decimal hours.

Can this formula calculate a full 24-hour shift?

No. Equal start and end times return one hour. Use start and end dates as well as times if shifts can last 24 hours or longer.

Why does the result look like a time instead of a number?

Select the result cell and choose Home > Number > Number in Excel. The formula returns decimal hours, so it should not use a time format.