To calculate total work hours in Excel, subtract the start time from the end time (End Time - Start Time) and multiply the result by 24 to convert the time value into a decimal number. This process allows you to transform Excel's internal time tracking—which views one full day as the number 1—into usable hours that can be multiplied by an hourly wage for payroll purposes.
What You'll Need
- Microsoft Excel (any modern version)
- A basic understanding of how to select cells and enter formulas
- A structured layout with columns for Date, Start Time, End Time, and Total Hours
Step-by-Step
- Set Up Your Data Table: Create a table with clear headers. In cell A1, type "Date"; in B1, type "Start Time"; in C1, type "End Time"; and in D1, type "Total Hours". This structure ensures that your formulas have consistent references to pull from.
- Format Your Time Cells: Select the columns for Start Time and End Time (Columns B and C). Right-click the selection, choose "Format Cells", go to the "Number" tab, select "Time", and choose a format like "1:30 PM". This ensures Excel recognizes your entries as time values rather than plain text.
- Enter Your Basic Calculation: In cell D2 (under Total Hours), enter the formula
=C2-B2. This subtracts the start time from the end time. If you enter 9:00 AM in B2 and 5:00 PM in C2, Excel will initially show the result as 8:00 (in time format). - Convert Time to Decimal Hours: Because Excel treats 24 hours as the integer 1, a result of 8 hours is actually stored as 0.333. To turn this into a number you can use for pay, change your formula to
=(C2-B2)*24. - Format the Result as a Number: The result of the multiplication might still look like a time (e.g., 12:00 AM). Select cell D2, right-click, choose "Format Cells", and change the category to "Number" with two decimal places. Now, 8 hours will appear as "8.00".
- Handle Unpaid Breaks: If employees have a standard 30-minute unpaid break, you must subtract this from the total. You can either add a "Break" column (Column E) and use the formula
=((C2-B2)*24)-E2(where E2 is entered as a decimal, like 0.5 for 30 minutes), or simply subtract the value directly:=((C2-B2)*24)-0.5. - Account for Overnight Shifts: If a shift starts at 10:00 PM and ends at 6:00 AM the next day, the basic subtraction formula will result in a negative number or a series of hash symbols (#######). To fix this, use the MOD function:
=MOD(C2-B2, 1)*24. The MOD function ensures that if the end time is smaller than the start time, Excel adds 1 (a full day) to the calculation to keep the result positive. - Calculate Total Weekly Hours: At the bottom of your Total Hours column, use the SUM function. If your hours are in cells D2 through D8, enter
=SUM(D2:D8). Ensure this cell is also formatted as a "Number" so it displays the total as a decimal (e.g., 40.00) rather than resetting to zero after 24 hours. - Compute Total Pay: In a new cell, enter your hourly rate (e.g., 20.00 in cell F2). In the cell next to your total weekly hours (e.g., E9), enter the formula
=D9*F2. This multiplies the decimal hours by the hourly rate to give you the gross pay.
Common Mistakes
One of the most frequent errors is forgetting to multiply by 24. Users often see a result like "8:00" and assume it is correct, but when they multiply that by a wage of $20, they get a tiny number (like $6.67) because Excel is multiplying the wage by the fraction of a day (0.333) rather than the number of hours. Always verify that your "Total Hours" column is formatted as a Number, not as Time.
Another common mistake is entering times without a space before the AM or PM (e.g., "9:00AM" instead of "9:00 AM"). Excel may treat the former as text rather than a time value, which will cause your formulas to return a #VALUE! error. Always use a space to ensure the software recognizes the time format.
Many users also forget to account for the "24-hour wrap-around." If you use a simple subtraction formula for a night shift, Excel cannot display negative time and will fill the cell with hashtags. Using the MOD function is the only reliable way to handle shifts that cross midnight without manually adding dates to the time entries.
Tips
To speed up data entry, use the keyboard shortcut Ctrl + Shift + : (colon) to insert the current time into a cell. This is useful for real-time clock-ins.
For more professional sheets, use "Data Validation" to restrict the Start and End time columns. Go to the Data tab > Data Validation and set the criteria to "Time". This prevents users from accidentally entering text or dates into the time fields, which would break your formulas.
If you need to track overtime, use an IF statement. For example, if your total hours are in D9 and the standard work week is 40 hours, you can calculate overtime hours with =IF(D9>40, D9-40, 0). This tells Excel: "If the total hours are greater than 40, subtract 40 from the total; otherwise, show 0."
Troubleshooting
If your formula returns #VALUE!, it means Excel thinks one of your cells contains text instead of a number or time. Check for leading spaces, missing spaces before AM/PM, or typos. You can test if a cell is truly a number by using the formula =ISNUMBER(B2); if it returns FALSE, the time was entered as text.
If your cell is filled with #######, it usually means one of two things: the column is too narrow to display the result, or the formula has resulted in a negative time value. Try widening the column first. If that doesn't work, check if the shift crossed midnight; if it did, replace your subtraction formula with the =MOD(End-Start, 1)*24 version.
If your total sum seems wrong (e.g., it says 12 hours when it should be 36), your cell is likely formatted as "Time" instead of "Number". In Time format, Excel resets the clock every 24 hours. Change the cell format to "Number" or a custom format like [h]:mm to allow the hours to accumulate beyond a single day.
Frequently Asked Questions
How do I subtract a lunch break automatically?
The easiest way is to subtract the break as a decimal. Since 30 minutes is 0.5 hours, use =((End-Start)*24)-0.5. If the break varies, create a separate column for break duration and subtract that cell.
Why does my total hours cell show 0.33 instead of 8?
This happens because the cell is formatted as a General number instead of a Time value, but you haven't multiplied by 24 yet. Excel stores 8 hours as 1/3 of a day (0.333). Multiply the result by 24 to get the decimal hour count.
Can I use this for 24-hour (military) time?
Yes. Excel handles military time (e.g., 14:00) perfectly. You can change the cell formatting to "Time" and select the 24-hour option, and all the subtraction and MOD formulas will work exactly the same.
How do I calculate pay for different rates (Regular vs Overtime)?
Use a combination of the SUM and IF functions. Calculate regular pay by multiplying the first 40 hours by the base rate, and then calculate overtime pay by multiplying the hours exceeding 40 by the overtime rate (usually base rate * 1.5), then add the two totals together.
What happens if I leave a cell blank?
A blank cell is treated as zero. If the start time is blank, Excel treats it as 12:00 AM on January 0, 1900, which will result in a very large, incorrect number of hours. To prevent this, wrap your formula in an IF statement: =IF(OR(B2="", C2=""), "", (C2-B2)*24).