To figure out hours worked in Excel, subtract the start time from the end time (End Time - Start Time). Because Excel treats time as a fraction of a 24-hour day, you must format the result cell as Time or use a multiplication formula (Result * 24) to convert the duration into a decimal number for payroll calculations.
What You'll Need
- Microsoft Excel (any modern version)
- A list of start and end times
- Basic knowledge of how to enter data into cells
Step-by-Step
- Set Up Your Columns: Create a table with clear headers. For example, label cell A1 as "Date", B1 as "Start Time", C1 as "End Time", and D1 as "Total Hours".
- Enter Your Data: Input your times using a format Excel recognizes. For example, type "8:00 AM" or "17:00" (for 24-hour time). Ensure you include a space before the AM/PM indicator.
- Apply the Basic Subtraction Formula: Click on cell D2 (the first cell under Total Hours). Type the formula
=C2-B2and press Enter. This subtracts the start time from the end time. - Format the Result as Time: If the result looks like a decimal or a strange date, right-click the cell, select Format Cells, go to the Number tab, select Time, and choose the "13:30" format.
- Handle Unpaid Breaks: If you need to subtract a break (e.g., 30 minutes), add a "Break" column (Column E). Enter the break duration as "0:30". Update your formula in D2 to
=C2-B2-E2. - Convert Time to Decimals for Payroll: To multiply hours by an hourly rate, you cannot use the "Time" format because Excel sees "8:00" as 0.33 of a day. Instead, use this formula:
=(C2-B2)*24. - Format the Decimal Result: Right-click the cell with the decimal formula, select Format Cells, and choose Number with 2 decimal places. This converts "8:30" into "8.5", which can then be multiplied by a dollar amount.
- Calculate the Grand Total: Use the
=SUM()function at the bottom of your Total Hours column to find the weekly or monthly total.
Common Mistakes
- Incorrect Time Entry: Typing "8am" without a space (8 am) can cause Excel to treat the entry as text rather than a numerical value, making formulas fail.
- Ignoring the 24-Hour Wrap: If a shift starts at 10:00 PM and ends at 6:00 AM the next day, a simple subtraction will result in a negative number or a series of hashtags (######).
- Using Time Format for Pay: Trying to multiply a "Time" formatted cell (like 8:00) by a wage (like $20) will result in a tiny, incorrect number because Excel is multiplying 0.33 by 20, not 8 by 20.
- Mixing Date and Time: Entering a full date and time in one cell but only a time in another can confuse the subtraction formula.
Tips
- Use AutoFill: Once you have written your formula in the first row, click the small green square in the bottom-right corner of the cell and drag it down to apply the calculation to all rows.
- Keyboard Shortcut: Press
Ctrl + Shift + @to quickly format a selected cell as Time. - Data Validation: Use the Data Validation tool (Data > Data Validation) to restrict entries in the time columns to "Time" only, preventing typos.
- Absolute References: If your hourly rate is in one specific cell (e.g., G1), use an absolute reference (
$G$1) in your pay formula so the rate doesn't shift when you drag the formula down.
Troubleshooting
If your calculations are not working as expected, try these steps in order:
- Check for Hashtags (######): If a cell is filled with hashtags, it usually means the result is a negative time (common with overnight shifts) or the column is too narrow. First, widen the column. If the hashtags remain, use the formula
=MOD(C2-B2, 1)to handle shifts that cross midnight. - Verify Cell Formatting: If the result looks like "0.35416", the cell is formatted as "General". Change it to "Time" or "Number" depending on whether you want to see hours/minutes or a decimal.
- Check for Text Formatting: If the formula returns a
#VALUE!error, one of your time entries is likely formatted as text. Re-type the time and ensure there is a space before the AM/PM. - Reset the Format: If the cell is behaving erratically, go to the Home tab and select Clear > Clear Formats, then re-apply the correct number format.
Frequently Asked Questions
How do I calculate hours if the shift goes past midnight?
Use the MOD function: =MOD(End_Time - Start_Time, 1). This tells Excel to treat the result as a positive fraction of a 24-hour cycle, correctly calculating the difference even if the end time is numerically smaller than the start time.
Why does my total sum stop at 24 hours?
By default, Excel resets the time clock every 24 hours. To show a cumulative total (e.g., 45 hours), right-click the total cell > Format Cells > Custom and type [h]:mm. The square brackets tell Excel to accumulate hours beyond a single day.
How do I subtract a 30-minute lunch break automatically?
You can subtract the time directly in the formula by using the TIME function: =(C2-B2)-TIME(0,30,0). This subtracts 0 hours, 30 minutes, and 0 seconds from the total.
Can I calculate hours worked if I only have a total number of minutes?
Yes. If you have a total of minutes (e.g., 480), divide that number by 1440 (the number of minutes in a day). Format the resulting cell as "Time" to see it as 8:00.
How do I convert 8 hours and 15 minutes to 8.25?
Multiply the time result by 24 and change the cell format to "Number". Since 15 minutes is one-quarter of an hour, Excel will convert the time value to the decimal 8.25.