HomeGoogle DocsSpreadsheetPayroll Hours Time Calculation in Google Sheets Using Time Functions

Payroll Hours Time Calculation in Google Sheets Using Time Functions

Published on

Payroll hours time calculation is important when you want to perform overtime hours calculation of your long list of employees. It will be time taking to manually add the overtime hours worked by employees if the number of employees is large.

During my tenure with my past employer, I used Google Sheets time calculation so many times for calculating the overtime hours worked by the operator of our hired equipment.

You can use a simple Google Sheets time formula to sum hours and minutes. So let me explain how to use Google Sheets time functions to add hours and minutes in your payroll as well as in other similar time calculations.

I am going to use two Google Sheets time functions in this payroll time calculation. They are MINUTE and HOUR.

If you are doing lots of time-related calculations, I suggest you check my Google Sheets complete time functions tutorial as a reference guide.

Similar: Google Sheets Complete Date Functions.

Back to our payroll hours calculation in Google Sheets. You can follow this tutorial to use your Spreadsheet as a payroll hours calculator or time sheet calculator.

Steps: Payroll Hours Time Calculation in Google Sheets

Important:

  • Time should be in 24 hr formats like 17:30:00. If it’s not, you can set it from the Format -> Number. This is to just avoid error. But 12-hour format will also work.
  • I only considered the hours and minutes in this calculation. I have excluded seconds as it’s not important in payroll. So please take care while entering the time inputs.

Enter the below sample data in a new Google Spreadsheet to sum hours and minutes worked (total of time difference).

Sample data for Payroll hours time calculation

With a one-line array formula, you can get the sum of hours and minutes worked. I will come to that later.

First, we can use individual formulas. It will help you to understand the functions Hour and Minute.

Non-Array Formula to Calculate Payroll Hours Time Difference

Example:

Time addition in Google Sheets

Here I am explaining the highlighted part of the formula. The same you can copy to the cells down and use the sum function to find the total hours worked.

Formula Explanation

Step 1: Formula in E2.

First let me go into the detail of the formula in cell E2.

=hour(D2-C2)

Drag this formula down until cell E11.

The HOUR formula returns the hour component from a given time. So here we used it to find the difference of hours between a start time and end time. The result will be of course in hours.

Step 2: Formula in F2.

Similarly, we can calculate the minute difference. Here is the formula in cell F2 and explanation.

=MINUTE(D2-C2)

Drag this formula down until cell F11.

The MINUTE formula returns the minute component of a given time. Here the above formula returns the difference between minutes from the start and end time.

Please note that the Minute formula only considers the minute components of the start and end time. Hours will be excluded.

Step 3: Formula in G2.

Converts minutes difference that we have just got in the above step to hours. So that we can add this later to the hours we got in Step 1.

=F2/60

Drag this formula down until cell F11.

Step 4: Formula in H2.

So we have the hours difference in hours and minutes difference also in hours. Just add these values. You can see the same in cell H2.

=E2+G2

Drag this formula down until cell H11.

Array Formula to Calculate Payroll Time Difference and Total

You can use an array formula to add all the above calculations in one line. Apply the below formula in cell I2. No need to copy/drag this formula down.

=ARRAYFORMULA((HOUR(D2:D11-C2:C11))+(MINUTE((D2:D11-C2:C11)))/60)
Arrayformula to Sum time difference in payroll

As you can see in I12 I have used the SUM function to total the output of the Array Formula.

=sum(I2:I11)

The whole process in the Payroll Hours Time Calculation is actually simple. Just wrap the above array formula with sum!

One line formula to calculate and sum time difference.

You must create a sample data same as above and apply the formulas yourself to understand it. Just reading the above tutorial won’t be sufficient to master it. Hope to see you again with another useful Google Sheets tutorial.

Additional Resources:

  1. How to Deduct Lunch Break Time From Total Hours in Google Sheets.
  2. Google Sheets: The Best Overtime Calculation Formula.
  3. How to Convert Military Time in Google Sheets.
  4. Move Time In and Time Out to the Same Row in Google Sheets.
  5. Elapsed Days and Time Between Two Dates in Google Sheets.
  6. How to Add Hours, Minutes, Seconds to Time in Google Sheets.
  7. How to Format Time to Millisecond Format in Google Sheets.
Prashanth KV
Prashanth KV
Your Trusted Google Sheets and Excel Guide Prashanth KV brings a wealth of experience in Google Sheets and Excel, cultivated through years of work with multinational corporations in Mumbai and Dubai. As a recognized Google Product Expert in Docs Editors, Prashanth shares his expertise through insightful blogging since 2012. Explore his blog for practical tips and guidance on maximizing your spreadsheet skills.

Filter Data from the Previous Month Using a Formula in Excel

Filtering data from the previous month may be useful for comparative analysis, generating reports,...

Interactive Random Task Assigner in Google Sheets

You have multiple tasks and multiple people. Here's a fun way to randomly assign...

Google Sheets Bar and Column Chart with Target Coloring

To color each data point in the column or bar chart according to the...

Analyzing Column A Between Non-Adjacent Values in Column B: Google Sheets

This tutorial addresses a common scenario encountered in Google Sheets: how to sum, average,...

More like this

Interactive Random Task Assigner in Google Sheets

You have multiple tasks and multiple people. Here's a fun way to randomly assign...

Google Sheets Bar and Column Chart with Target Coloring

To color each data point in the column or bar chart according to the...

Analyzing Column A Between Non-Adjacent Values in Column B: Google Sheets

This tutorial addresses a common scenario encountered in Google Sheets: how to sum, average,...

9 COMMENTS

  1. I am a rideshare driver. I record the time I start and the time I end.

    I want to know how many hrs/minutes per ride.

    For example, if I work 9 hours, 30 minutes, and give 22 rides, how do I determine how much time each ride took?

    • Hi, Bond,

      It is not possible to code a formula without seeing the data formatting.

      Can you please make a copy of your sheet and share it (the URL) after replacing the original data with mockup data?

      You can leave it in “reply” below. I won’t publish it.

  2. Hello,

    I have the format in 24hr time and I get an error message when the end time gets to midnight. An example is 17:30 – 00:03, the error message that pops up is: Error
    Function HOUR parameter 1 value is negative. It should be positive or zero.
    I have it set up exactly how you show in the examples, conversion of hours, minutes, etc.

    • Hi, Natalie,

      In such a case, if you want to use the same formula, use DateTime (Timestamp);

      Start: 16/01/2020 17:30:00
      End: 17/01/2020 00:30:00

      …instead of time.

      Note: Use the DateTime format as per your Locale.

      Also, there is a different method using a ‘new’ formula. See the link to that guide at the bottom of my post (the second link under “Additional Resources”)

  3. Using the 12-hour clock format, what if the shift duration starts at PM and ends at AM?

    I am having trouble setting up a calculation sheet on Google Docs. For example, how would you formulate the durations of hours from 3:00 PM to 12:30 AM on a Google Doc?

    • Hi, Brenda,

      You can refer to the tutorial under “Additional Resources” above (Point # 2).

      Assume cell F3 contains 3:00 pm (15:00:00) and F4 contains 12:30 am (00:30:00). That means the job starts on Day 1 and ends on Day 2.

      In such scenarios, to find the duration use this formula.

      =MOD(F4 - F3,1)

      Format the output to Duration from the Format menu, Number.

      Best,

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.