Download the example workbook
This tutorial will demonstrate how to calculate hours worked in Excel and Google Sheets.
Calculate Hours with a Simple Formula
In Excel, times are stored as decimal values. Knowing this, you can simply subtract the start time (“Clock In”) from the end time (“Clock Out”) to find the time worked. (Note, we multiply by 24 to convert the decimal values into hours).
In the previous, we displayed the times as decimal values to demonstrate how they are stored. We did this, by changing the formatting to “Number”):
If the end time is before the start time (ex. night shift) the formula will return a negative number. To solve this problem, use the MOD Function.
As with the simple formula, we need to multiply the value calculated by the MOD Function by 24 to get the hours worked.
We can use the same type of formula to calculate overtime.
In the example above, the standard time is 8 hours.
The following formula calculates the Normal time worked in the day.
If the employee has worked more than 8 hours, the formula will only return a maximum of 8 hours.
To calculate the overtime, we can get the rest of the hours worked using this formula below:
Calculate Hours Worked in a Weekly Timesheet
The overtime is calculated once a person works more than 40 hours a week.
The first part of the first range of the SUM Function is an absolute, while the second part is not. As you copy this formula down to the bottom of the table, you will notice that the SUM function adds up all the Hours worked in column E. As the SUM range is increased, so the hours worked is increased. Once the SUM gets to more than 40 hours, Overtime hours are put into the Overtime column as an increasing total.
Calculate Regular Hours
The regular hours are calculated based on the total hours, and the overtime worked.
We use the MAX Function so that we do not end up with Negative hours where the Employee has worked overtime as if the result returns a negative, then the MAX function will return a zero.
Easy Excel Automation
Add Excel automation to your workbook with just a few clicks.
Calculate Hours Worked in a Weekly Timesheet by Project
Taking the calculation above one step further, we can divide the hours worked by the Project that the employee worked on using the SUMIF Function
The SUMIF function will sum the Regular hours in column F according to the criteria selected in column H – in the case of the above formula, it will look for the ABC Project and sum the Regular hours for that project.
Calculating Hours Worked in Google Sheets
All the above Excel examples work the same way in Google Sheets.