Excel Time Calculations: How to Add, Subtract & Format
In this article
To calculate time in Excel, enter times as hh:mm (or hh:mm:ss) and subtract one from the other; the result is a fraction of a day, so multiply by 24 to get decimal hours, or apply a time format to show hours and minutes. The one rule that prevents most errors: Excel stores time as a portion of a 24-hour day, so 6:00 AM is 0.25 and 6:00 PM is 0.75. Once you accept that, adding, subtracting and formatting times becomes predictable. This guide covers the exact formulas, the formatting traps, and the fixes when a result looks wrong.
What You'll Need
- Excel on Windows, Mac, or Excel for the web (the formulas are identical; menu labels can differ slightly by version and platform).
- Times entered in a recognised format, such as
9:00,9:00 AM, or17:30. Text like "9am" may be stored as text and break formulas. - A basic understanding that dates are whole numbers and times are decimals: 12:00 PM is 0.5, 6:00 AM is 0.25.
Step-by-Step
- Enter start and end times in separate cells. Put the start in A2 and the end in B2. Type
9:00 AMin A2 and5:30 PMin B2. Excel right-aligns real times; if the entry sits on the left, it is text and needs re-entering. - Subtract the start from the end. In C2, type
=B2-A2. The result appears as a time such as8:30 AMif the cell already has a time format, or as a decimal like0.354166667if it is General. Both are correct; they are the same number shown differently. - Convert to decimal hours when you need a number. Use
=(B2-A2)*24to get 8.5 hours. For minutes, use=(B2-A2)*1440; for seconds,=(B2-A2)*86400. This is the step most people miss: without the multiplier, the result is a fraction of a day, not hours. - Format the result cell for elapsed time. Select C2, press Ctrl+1 (Cmd+1 on Mac) to open Format Cells, choose Custom, and type
[h]:mm. The square brackets tell Excel to keep counting past 24 hours instead of rolling over at midnight. For hours and minutes with seconds, use[h]:mm:ss. - Add times together. To total several durations, use
=SUM(C2:C10)and apply the[h]:mmformat. A plainh:mmformat would show 26 hours as 2:00, which looks like a two-hour total and causes real payroll errors. - Handle shifts that cross midnight. If the end time is earlier than the start time (for example start 22:00, end 06:00), use
=MOD(B2-A2,1). MOD wraps the negative result back into a positive time. Format the cell as[h]:mmto see 8:00. - Include dates when shifts span days. If A2 is
3/1/2025 22:00and B2 is3/2/2025 06:00, plain subtraction=B2-A2works and returns 8:00. Enter full date-and-time values rather than times alone whenever the shift crosses midnight, because Excel cannot tell which day a bare time belongs to. - Calculate elapsed time from a start stamp to now. Use
=NOW()-A2and format as[h]:mm. NOW() updates whenever the sheet recalculates, so the value is not frozen; copy and paste as values if you need a fixed record. - Round to payable increments if required. To round to the nearest quarter hour, use
=MROUND((B2-A2)*24,0.25). MROUND is available in current Excel versions; if it errors, use=ROUND((B2-A2)*24*4,0)/4instead. - Check a sample by hand. 9:00 AM to 5:30 PM should give 8.5 decimal hours or 8:30 in
[h]:mm. If it does not, the entries are probably text or the format is wrong, not the formula.
Common Mistakes
- Formatting totals as
h:mminstead of[h]:mm. This is the single most common error. Totals over 24 hours silently wrap around and look plausible, so the mistake survives review. - Forgetting the *24 multiplier. A result of 0.354 looks wrong but is correct as a fraction of a day. Multiply by 24 for hours, 1440 for minutes, 86400 for seconds.
- Typing times as text. Entries like "9am" or "9.00" may be stored as text. They left-align and return
#VALUE!in arithmetic. Re-enter as9:00 AMor convert with TIMEVALUE. - Subtracting without MOD across midnight.
=B2-A2returns a string of hash marks when the end time is earlier than the start, because negative time cannot be displayed in the default 1900 date system. - Mixing date systems. Workbooks created on Mac historically used the 1904 date system. Copying times between a 1904 workbook and a 1900 workbook shifts every value by four years and four hours. Check File > Options > Advanced for the date system setting if numbers look consistently off.
Tips
- Use 24-hour entry (
17:30) to avoid AM/PM ambiguity, especially when sharing sheets across regions. - Press Ctrl+Shift+2 (Ctrl+Shift+@ on some layouts) to apply a time format quickly to the selected cells.
- Keep start and end in separate columns and the duration in a third. Combining them into one cell makes auditing and sorting far harder.
- For timesheets, add a helper column with
=(B2-A2)*24for decimal hours and keep a separate[h]:mmcolumn for display. Payroll systems usually want decimals. - If you paste times from another system, use Paste Special > Values and then check alignment; left-aligned entries are text.
Troubleshooting
The cell shows ##### . The column is too narrow, or the value is negative. Widen the column first. If it persists, the result is negative time; wrap the formula in MOD or add dates to the entries.
The formula returns #VALUE!. One of the cells contains text. Click the cell and look at the alignment and the formula bar. Re-enter the time using a colon, or convert with =TIMEVALUE(A2).
The total is wrong but each row looks right. Check the total cell's format. It is almost certainly h:mm rather than [h]:mm. Change it in Format Cells > Custom.
Times shift by hours when copied between files. The two workbooks use different date systems. Align them in File > Options > Advanced, or re-enter the times in the destination file.
NOW() keeps changing. That is by design. Copy the cell and use Paste Special > Values to freeze the result.
Frequently Asked Questions
Why does Excel show 0.5 instead of 12:00?
Because time is stored as a fraction of a day. 0.5 is noon. Apply a time format to display it as 12:00 PM; the underlying value does not change.
How do I add 30 minutes to a time?
Use =A2+TIME(0,30,0) or =A2+30/1440. Both add half an hour. Format the result as a time.
Why does my total show 2:00 when it should be 26:00?
The cell is formatted as h:mm, which wraps at 24 hours. Change the custom format to [h]:mm.
Can Excel calculate time across midnight?
Yes. Use =MOD(B2-A2,1) for bare times, or enter full dates with the times and subtract normally.
How do I convert 8:30 to 8.5?
Multiply by 24: =(B2-A2)*24. Format the result as a number with the decimals you need.
Why do I get a negative time error?
The end time is earlier than the start time and no date is attached. Add dates to both entries or use MOD to wrap the result.