To calculate hours in Excel, enter your start time in one cell and your end time in another, then subtract the start from the end and format the result as a time or as decimal hours. For a timesheet, add a total row with =SUM(range) and apply a custom format like [h]:mm so totals over 24 hours display correctly. This guide walks through the exact steps, the formatting gotchas that cause wrong answers, and how to turn a time result into a number you can multiply by an hourly rate.
What You'll Need
- Microsoft Excel on Windows, Mac, or the web version (the steps below work in all three; menu labels can differ slightly by version and region).
- Start and end times for each shift, in a consistent format such as 9:00 AM and 5:30 PM.
- If you are calculating pay, an hourly rate in a separate cell.
Step-by-Step
- Set up your columns. In row 1, type labels: Date in A1, Start in B1, End in C1, Break (hours) in D1, and Hours Worked in E1. Labels are optional but make formulas easier to read and audit.
- Enter times as real times. Type 9:00 AM or 09:00 into B2 and 5:30 PM or 17:30 into C2. Excel recognises these as time values. Do not type 9am with no space or 9.00 with a period; those may be stored as text and will break the subtraction.
- Subtract end minus start. In E2, type =C2-B2 and press Enter. If you entered 9:00 AM and 5:30 PM, Excel returns 8:30, meaning 8 hours 30 minutes.
- Format the result as hours and minutes. Select E2, right-click, choose Format Cells, go to the Number tab, pick Custom, and type h:mm in the Type box. Click OK. Without this step, Excel may show a decimal like 0.354167, which is the same value expressed as a fraction of a day.
- Subtract unpaid breaks. If a shift includes a 30-minute unpaid break, put 0:30 in D2 and change E2 to =C2-B2-D2. Enter the break as a time, not as the number 30, or Excel will subtract 30 full days.
- Copy the formula down. Drag the fill handle from E2 down through your rows. Each row now calculates its own shift.
- Total the week. In E8 (or the row below your last shift), type =SUM(E2:E7). Select that total cell, open Format Cells > Custom, and set the type to [h]:mm. The square brackets tell Excel to keep counting past 24 hours instead of wrapping around to zero.
- Convert to decimal hours for pay. In a new cell, type =E8*24 and format it as a number with two decimal places. Excel stores times as fractions of a day, so multiplying by 24 converts 8:30 into 8.5. Multiply that by your hourly rate in another cell, for example =F2*15.50, to get gross pay.
- Handle overnight shifts. If someone starts at 10:00 PM and finishes at 6:00 AM, plain subtraction gives a negative number. Use =MOD(C2-B2,1) instead. The MOD function wraps the negative result back into a positive time.
- Check for text entries. If a total looks wrong, click a start or end cell and look at the alignment. Real times align to the right by default; text aligns left. Re-type any left-aligned entries using a colon between hours and minutes.
Common Mistakes
- Formatting the total as h:mm instead of [h]:mm. A 45-hour week displays as 21:00 because Excel resets at 24 hours. The brackets fix it.
- Typing break minutes as a plain number. Entering 30 in the break column subtracts 30 days. Enter 0:30 or 30/1440 instead.
- Mixing 12-hour and 24-hour entry. Typing 5:00 for a 5 PM finish when Excel expects morning gives a negative result. Be consistent, or use AM/PM everywhere.
- Leaving times as text. Copying times from another system can paste them as text. The subtraction then returns an error or zero.
- Forgetting that a negative time shows as #####. This is a display limit, not lost data. Fix the formula with MOD or correct the entry.
Tips
- Use Ctrl+Shift+2 (Windows) or Cmd+Shift+2 (Mac) to apply a time format quickly to selected cells.
- Keep break time in its own column so you can change policy without editing every formula.
- Add a Rate column and a Pay column if you run payroll from the same sheet; the decimal conversion makes the multiplication straightforward.
- Round only at the end. Rounding each shift first and then summing can shift the weekly total by several minutes.
- Save a blank copy as a template so each new pay period starts clean.
Troubleshooting
The result shows a decimal like 0.354167. The formula is correct; the cell is formatted as General or Number. Apply the h:mm custom format.
The total shows ##### or a small number. The total cell is using h:mm rather than [h]:mm. Reapply the custom format with brackets.
You get a negative time or an error. The end time is earlier than the start time. For overnight shifts use =MOD(C2-B2,1). If the error is #VALUE!, one of the cells contains text rather than a time.
Subtraction returns zero. Both cells likely hold the same value, or one was entered as text. Check alignment and re-enter.
Times pasted from another system will not calculate. Select the column, use Data > Text to Columns, and finish the wizard without changing anything; this often coerces text times into real times. If that fails, retype a few entries manually to confirm the format.
The file was saved as CSV and formats disappeared. CSV does not store cell formatting. Save as .xlsx to keep custom time formats.
Frequently Asked Questions
Why does Excel show 0.5 instead of 12:00?
Excel stores one day as the number 1, so 12 hours is 0.5. Format the cell as a time to display it as 12:00.
How do I total more than 24 hours?
Use the custom format [h]:mm on the total cell. The brackets stop Excel from wrapping at 24 hours.
How do I calculate pay from hours worked?
Multiply the total time by 24 to get decimal hours, then multiply by the hourly rate. For example, 8:30 becomes 8.5, and 8.5 times the rate gives gross pay.
Can I calculate hours across midnight?
Yes. Use =MOD(End-Start,1) so the negative result wraps into a positive time.
Why is my total off by a few minutes?
Check for text entries, mixed AM/PM entry, or breaks entered as whole numbers instead of times. Also confirm you are not rounding individual shifts before summing.
Does this work in Excel for the web?
Yes. The formulas and custom number formats described here work in Excel for the web, on Windows, and on Mac, though menu wording can vary slightly by version.