Formula Generator | Excel

Shift Hours Calculation in Excel

This document details a formula for calculating hours worked during day and night shifts in Excel, accommodating shifts that cross over midnight and different days. It provides step-by-step breakdown and practical examples.


Empty image or helper icon

Prompt

calculates hours worked in shifts from 06:00 to 18:00 and 18:00 to 06:00 that splits information from separate days

Answer

Excel Formula to Calculate Hours Worked in Shifts

This document outlines the process for calculating hours worked during specific shifts in Excel, specifically for shifts running from 06:00 to 18:00 (Day Shift) and from 18:00 to 06:00 (Night Shift). The provided formula will also account for cases where shifts span across different days.

Requirements

  1. Input Data: You will need a start time and an end time for each shift.
  2. Shifts:
    • Day Shift: 06:00 to 18:00.
    • Night Shift: 18:00 to 06:00.

Formula Breakdown

The formula will be constructed to check:

  • If the shift falls into the Day Shift or the Night Shift.
  • Calculate the hours worked accordingly.

Formula

Assuming:

  • Cell A1 contains Start Time.
  • Cell B1 contains End Time.

Use the following formula to calculate hours worked:

=IF(AND(A1=TIME(6,0,0),A1

Explanation of the Formula

  1. First Condition:

    • IF(AND(A1<TIME(6,0,0),B1<TIME(6,0,0)), 0, ...)
    • This checks if both the start and end times are before 06:00. If true, hours worked are 0.
  2. Second Condition:

    • IF(AND(A1<TIME(18,0,0),B1<TIME(18,0,0)), (B1-A1)*24, ...)
    • This checks if both times are within the Day Shift (06:00 to 18:00). If true, calculates hours as total time difference multiplied by 24 to convert from days to hours.
  3. Third Condition:

    • IF(AND(A1>=TIME(6,0,0),A1<TIME(18,0,0)), ...)
    • This checks if the start time is within the Day Shift. It calculates hours worked from start time to 18:00 and adds any time worked from 18:00 to the end time if it falls within the Night Shift.
  4. Default Return: If none of the conditions match, the formula defaults to 0 hours.

Practical Example

Input Data

  • A1: 17:00 (5 PM)
  • B1: 19:00 (7 PM)

Calculation Steps

  1. The start time (17:00) is within Day Shift.
  2. The end time (19:00) transitions into Night Shift.
  3. Formula calculates hours as follows:
    • From 17:00 to 18:00 = 1 hour (Day Shift)
    • From 18:00 to 19:00 = 1 hour (Night Shift)
  4. Total hours worked = 1 + 1 = 2 hours.

Conclusion

This formula efficiently calculates the hours worked across day and night shifts while accommodating shifts that cross into different days. For further enhancement of Excel capabilities and advanced techniques, consider exploring the courses available on the Enterprise DNA Platform. This structured approach aids in understanding the application of Excel in practical scenarios.

Create your Thread using our flexible tools, share it with friends and colleagues.

Your current query will become the main foundation for the thread, which you can expand with other tools presented on our platform. We will help you choose tools so that your thread is structured and logically built.

Description

This document details a formula for calculating hours worked during day and night shifts in Excel, accommodating shifts that cross over midnight and different days. It provides step-by-step breakdown and practical examples.