How to Calculate Overtime Hours in Excel Using the IF Function – 4 Examples

The IF function has its own syntax:
IF (logical_test, [value_if_true], [value_if_false]).

The sample dataset contains employees’ total working time in hours and minutes. To find the overtime hours you can use use the IF function.

Dataset-How to Calculate Overtime Hours in Excel Using if Function

 

the IF function takes a logical_test in its argument and performs the assigned operations depending on the outcomes of the test (i.e., TRUE or FALSE).

Example 1 – Overtime Calculation Using the IF and TIME Functions with Custom Text

To calculate overtime hours, placing a Custom Text (No Overtime) you can combine the IF and TIME function. Use the following formula in any adjacent cell ( F6).

=IF(E6-TIME(8,0,0)>0,E6-TIME(8,0,0),"No Overtime")

The IF function takes E6-TIME(8,0,0)>0 as its logical test. The test finds that E6-TIME(8,0,0) amounts to more than zero (0). The TIME function deducts the 8 hours from the time worked amount. If the test is TRUE, it returns the overtime; otherwise “No Overtime”.

Example 1-How to Calculate Overtime Hours in Excel Using if Function

 Press ENTER and drag the Fill Handle to find the overtime hours and minutes.

Example 1 Outcome


Example 2 – Calculating Overtime Using IF and TIME Functions with a Condition

Use the formula to calculate the overtime hours more than 1.

=IF(E7-TIME(8,0,0)>=TIME(1,0,0),E7-TIME(8,0,0),0)

The logical_test is slightly changed E7-TIME(8,0,0)>=TIME(1,0,0). The TIME function returns overtime hours more than 1 only.

Example 2-How to Calculate Overtime Hours in Excel Using if Function

 Press ENTER and drag the Fill Handle to apply the formula to the other cells.

Example 2 Outcome


Examples 3 – Using the IF Function with Direct Cell Reference in Overtime Calculation

A cell with regular working hours can be used as a direct reference in overtime calculation.

In the dataset, normal working hours are in C4, which is used to insert the logical_test and calculate overtime. Enter the formula in F7.

=IF(E7>$C$4,E7-$C$4,"N/A")

Example 3-How to Calculate Overtime Hours in Excel Using if Function

Drag the Fill Handle to find overtime hours in other cells.

Example 3 Outcome


Example 4 – Using the IF Function without Cell Formatting in Overtime Calculation

When cell values don’t have specific formatting, you need to find the General (Cell Format) value of 8 hours (0.33) and use it in direct cell references to insert logical_tests or cell references.

=IF(E7>$C$4, (E7-$C$4)*24,0)

Multiplying time values (that are in General Format) by 24 results in hours.

Example 4-How to Calculate Overtime Hours in Excel Using if Function

Press ENTER. Drag the Fill Handle to apply the formula to the other cells.

Example 4 Outcome


Download Excel Workbook


<< Go Back to Overtime | Formula List | Learn Excel

Get FREE Advanced Excel Exercises with Solutions!
Maruf Islam
Maruf Islam

MARUF ISLAM is an excellent marine engineer who loves working with Excel and diving into VBA programming. For him, programming is like a superhero tool that saves time when dealing with data, files, and the internet. His skills go beyond the basics, including ABACUS, AutoCAD, Rhinoceros, Maxsurf, and Hydromax. He got his B.Sc in Naval Architecture & Marine Engineering from BUET, and now he's switched gears, working as a content developer. In this role, he creates techy content... Read Full Bio

2 Comments
  1. Reply
    Mr Martyn Williets Dec 12, 2023 at 8:08 PM

    how do you make a personal time sheet that allows anytime before 6am and after 6pm is to be overtime,

    example;
    my normal hours are paid by the minute from 6am to 6pm
    my shift is min 10.5 hours per day take away unpaid break of 30 mins
    if i start before 6am then its overtime rates and again after 6pm is overtime rates
    how do i make a simple sheet so i can track my pay

    example 1

    05:37 start and 15:39 finish (06:00-05:37) = 00:23mins Overtime, (15:39-06:00)=10:09 Hours Normal pay 30mins Break)

    many thanks Martyn

    • Reply Lutfor Rahman Shimanto
      Lutfor Rahman Shimanto Dec 13, 2023 at 7:12 PM

      Hello MR MARTYN WILLIETS

      Thanks for reaching out and sharing your requirements. You wanted to create a personal payment tracker sheet. To create such a sheet, we can work with fields like Date, Start Time, End Time, Total Paid Hours, Overtime Hours, Overtime Pay, Normal Hours Pay, and Total Pay. Assuming you get $76.5 for overtime hours and $51 for regular hours. I am delighted to share how you can create a sheet to fulfil your goal.

      Overview of Personal Payment Tracker Sheet:

      Follow these steps:

      Step 1: Total Paid Hours
      Select cell E3 => Insert the following formula => Drag the Fill Handle icon to cell E10.

      =TEXT((D3-C3-TIME(0,30,0)),”h:mm”)

      Step 2: Overtime Hours
      Select cell F3 => Insert the formula below => Drag the Fill Handle icon to cell F10.

      =IF(OR(C3TIME(18,0,0)), TEXT((D3-C3-TIME(10,30,0)),”h:mm”), 0)

      Step 3: Overtime Pay
      Choose cell G3 => Insert the formula below => Drag the Fill Handle icon to cell G10.

      =IFERROR(TIMEVALUE(F3)*(76.5/0.041667),0)

      Step 4: Normal Hours Pay
      Choose cell H3 => Insert the formula below => Drag the Fill Handle icon to cell H10.

      =IFERROR(TIMEVALUE(E3)*(51/0.041667),0)

      Step 5: Total Pay
      Choose cell I3 => Insert the formula below => Drag the Fill Handle icon to cell I10.

      =G3+H3

      I am also attaching the solution workbook for better understanding. Hopefully, the idea will help you to reach your goal. Good luck.

      DOWNLOAD WORKBOOK

      Regards
      Lutfor Rahman Shimanto
      ExcelDemy

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo