Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

Compute Hours in Excel: A Simple Step-by-Step Guide

· 5 min read · Home Tech

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

To compute hours in Excel, subtract the start time from the end time (=End_Time - Start_Time) and format the result cell as Time or a custom duration format. If the total exceeds 24 hours, you must apply the [h]:mm custom format to prevent Excel from resetting the clock to zero.

Calculating time in Excel can be confusing because the software treats one full day (24 hours) as the integer 1. This means an hour is actually 1/24th of a day. Understanding this relationship is the key to moving from simple time subtraction to calculating payroll or project durations.

What You'll Need

  • Microsoft Excel (any modern version)
  • A dataset containing start times and end times
  • Basic knowledge of how to enter formulas starting with an equals sign (=)

Step-by-Step

  1. Enter Your Data: Create three columns: "Start Time," "End Time," and "Total Hours." Enter your times using a colon (e.g., 8:00 AM or 17:00). Excel automatically recognizes these as time values.
  2. Apply the Basic Subtraction Formula: Click on the first cell in your "Total Hours" column. Type =, click the cell containing the end time, type -, and click the cell containing the start time.
    Example: =B2-A2
  3. Press Enter: Excel will display the difference. If the result looks like a decimal or a strange time, do not worry; this is a formatting issue that can be fixed in the next step.
  4. Format as Time: Right-click the result cell and select Format Cells. In the Number tab, select Time from the list on the left and choose the format that looks like 13:30.
  5. Handle Over-24-Hour Totals: If you are summing a column of hours (e.g., a weekly timesheet) and the total exceeds 24, Excel will "wrap around" and show only the remainder. To fix this:
    • Right-click the total cell and select Format Cells.
    • Go to the Number tab and select Custom.
    • In the "Type" box, manually type [h]:mm. The square brackets tell Excel to accumulate hours rather than resetting at 24.
  6. Convert Hours to Decimals (For Payroll): If you need to multiply hours by an hourly rate (e.g., 8.5 hours × $20), you must convert the time value to a decimal.
    • Multiply your time result by 24.
      Example: =(B2-A2)*24
    • Change the cell format from Time to Number or General.

Common Mistakes

  • Incorrect Time Entry: Entering "8.00" instead of "8:00". Excel treats "8.00" as a number (8 days), whereas "8:00" is treated as a time of day.
  • Ignoring the 24-Hour Reset: Using the standard "Time" format for a weekly total. If your total is 26 hours, Excel will display "2:00" because it removes the full 24-hour day. Always use [h]:mm for totals.
  • Multiplying Time by Currency: Trying to multiply a cell formatted as "Time" (e.g., 08:00) by a dollar amount. Because 8 hours is stored as 0.333 (1/3 of a day), the result will be wrong unless you multiply by 24 first to get the decimal version.

Tips

  • Use Keyboard Shortcuts: Press Ctrl + Shift + : (colon) to quickly insert the current time into a cell.
  • Military Time: To avoid confusion between AM and PM, enter times in 24-hour format (e.g., 14:00 instead of 2:00 PM). Excel handles both equally well.
  • Consistency: Ensure all cells in your time columns are formatted as "Time" before you start entering data to avoid manual correction later.

Troubleshooting

The result shows as a series of hashtags (#######): This usually happens if the result of your subtraction is negative (e.g., the start time is later than the end time). Excel cannot display negative time by default. Check if your end time is correct or if the shift crossed over midnight.

The result is a decimal like 0.375: The formula is working, but the cell is formatted as a "General" number. Change the cell format to Time via the Home tab dropdown or the Format Cells menu.

The total is way too low: Check if you are using the [h]:mm custom format for your sum. If you see 2 hours instead of 26, the square brackets are missing from your custom format.

Calculating shifts that cross midnight: If a shift starts at 10:00 PM and ends at 6:00 AM, a simple subtraction will result in a negative number. Use this formula instead: =MOD(End_Time - Start_Time, 1). The MOD function ensures the result stays positive by treating the time as a cycle of 1 day.

Frequently Asked Questions

Why does Excel show my total hours as a decimal?

Excel stores time as a fraction of a 24-hour day. For example, 12 hours is stored as 0.5. To see it as "12:00," you must change the cell format to Time.

How do I sum a column of hours?

Use the =SUM() function as you would with regular numbers. However, you must format the result cell as [h]:mm to ensure totals over 24 hours are displayed correctly.

Can I calculate hours if the dates are in different cells?

Yes. If you have the date and time in one cell (e.g., "2023-10-01 08:00"), you can still subtract them. The result will be the total number of days; multiply by 24 to convert that result into total hours.

How do I subtract a lunch break from the total?

Subtract the break duration from your final formula. If your break is in cell C2, your formula would be =(B2-A2)-C2. Ensure the break is also entered in a time format (e.g., 0:30 for 30 minutes).

What is the difference between "Time" and "Custom [h]:mm" formats?

The "Time" format is for a specific time of day (clock time). The "Custom [h]:mm" format is for duration (elapsed time), allowing the hour count to go above 24 without resetting.