Minus Hours in Excel: How to Subtract Time and Fix Errors
In this article
To subtract hours in Excel, use a simple subtraction formula such as =B2-A2 (End Time minus Start Time). However, because Excel's default date system cannot display negative time values, any result that falls below zero will appear as a series of hash marks (#######). To fix this, you must either use the 1904 Date System or a formula that converts the result into a text string or decimal.
What You'll Need
- Microsoft Excel (Desktop version for the 1904 Date System setting).
- A dataset containing time values formatted as Time or Custom (h:mm).
Step-by-Step
- Enter Your Data: Input your start time in one cell (e.g., A2) and your end time in another (e.g., B2). Ensure the cells are formatted as Time by selecting the cells, going to the Home tab, and choosing Time from the Number format dropdown.
- Apply the Subtraction Formula: In a third cell (C2), type
=B2-A2and press Enter. If the end time is later than the start time, Excel will display the duration correctly. - Handle Negative Results (The 1904 Method): If your calculation results in a negative number (e.g., subtracting 10 hours from 8 hours), Excel will show
#######. To enable negative time display:- Click File > Options.
- Select Advanced from the left-hand menu.
- Scroll down to the "When calculating this workbook" section.
- Check the box for Use 1904 date system.
- Click OK. The hash marks will now change to a negative time value (e.g., -2:00).
- Handle Times Crossing Midnight: If you are subtracting a start time (e.g., 10:00 PM) from an end time the next day (e.g., 6:00 AM), a simple subtraction will result in a negative number. Use this formula instead:
=B2-A2+(A2>B2). This adds 1 (representing 24 hours) if the start time is greater than the end time. - Convert to Decimals for Payroll: If you need the result as a decimal (e.g., 8.5 hours instead of 8:30), multiply the subtraction result by 24 and change the cell format to Number:
=(B2-A2)*24.
Common Mistakes
- Wrong Cell Formatting: Applying a "Time" format to a decimal result or a "Number" format to a time subtraction often leads to confusing results (e.g., 0.35 instead of 8:24). Always match the format to the intended output.
- Ignoring the Date: Subtracting time without dates only works if the events occur within the same 24-hour window. If the time spans multiple days, you must include the date in the cell (e.g.,
2026-12-05 08:00) for the math to be accurate. - Using the 1904 System on Shared Files: Changing to the 1904 Date System can shift existing dates in your workbook by four years. Do not enable this setting if your sheet already contains many specific calendar dates.
Tips
- Custom Formatting: To display hours that exceed 24 (e.g., a total of 35 hours for a work week), use the custom format
[h]:mm. The square brackets tell Excel to accumulate hours rather than resetting at 24. - Keyboard Shortcut: Press
Ctrl + Shift + @to quickly format a selected cell as Time. - Absolute References: If you are subtracting a fixed "break time" (like 0.5 hours) from multiple rows, put the break time in one cell (e.g., E1) and use
=B2-A2-$E$1to lock that cell.
Troubleshooting
If your calculations are not working as expected, try these steps in order:
- Check for "Text" Format: If the formula returns
#VALUE!, your times might be stored as text. Select the cell, go to the Data tab, select Text to Columns, and click Finish immediately to force Excel to recognize them as numbers. - Clear the Hash Marks: If you see
#######and do not want to use the 1904 system, use an IF statement to hide negative values:=IF(B2. - Verify Calculation Mode: If the result doesn't update when you change times, go to Formulas > Calculation Options and ensure Automatic is selected.
Frequently Asked Questions
Why does Excel show ####### when I subtract time?
Excel cannot display negative time values using the standard date system. This occurs when the start time is later than the end time, resulting in a negative duration.
How do I subtract hours across two different days?
The easiest way is to include the date and time in the cell. Alternatively, use the formula =B2-A2+(A2>B2), which automatically adds 24 hours if the end time is numerically smaller than the start time.
How do I convert a time result (like 8:30) into a decimal (8.5)?
Multiply the time difference by 24 and format the result cell as a "Number." For example: =(B2-A2)*24.
Will the 1904 Date System affect my other dates?
Yes. Enabling the 1904 system can shift existing dates in your workbook by approximately four years. Use this only in new workbooks or those without critical date entries.
How do I sum up total hours that go over 24?
By default, Excel resets the clock every 24 hours. To prevent this, right-click the cell, select Format Cells, go to Custom, and type [h]:mm:ss.