Formula Consolidation: Conditional Total Labor Hours with Clock-in/Clock-out Data

akicker

New Member
Joined
Feb 4, 2017
Messages
8
I am working with clock-in and clock-out data for various departments, with the goal of calculating Labor Hours for any given Department and Time Period. I am seeking help in consolidating my current method, preferably without Power BI or related tools. But I am open to all suggestions and whatever is most practical. The problem is the workbook gets very large and slow when I incorporate more and more data (e.g. 50,000+ work shift records, with 30+ formulas for each record).

My tool is accurate and works great for smaller data sets. I didn't write out explicit Excel statements, but rather explained generally what types of formulas I used.

Below is a snapshot of what I am currently doing. The first 4 Columns are raw data. Column E, Clock-Out, is calculated as Clock-in + Hours Worked. Then Column F and onward for each hour has the following algorithm in Excel syntax in every cell:

Code:
t = current hour (Column Header in Row 1)
Ci = clock-in time
Co = clock-out time
h1 = Excel's value for 1 hour (~0.041667)

if Ci <= t + h1 <= Co + h1:
    min(  1,
          (t + h1 - Ci) / h1,
          (Co - t) / h1
        )
else:
    0

This gives us the portion of the hour worked, for every hour:

ABCDEFGHIJK...ACADAEAFAGAHAI
1Dept.DateClock InHours WorkedClock Out00:0001:0002:0003:0004:0005:00......23:0024:0025:0026:0027:0028:0029:00
2Bar1/1/1701:153.504:45-0.751.001.000.75-...-------
3Bar1/1/1702:303.2505:45--0.501.001.000.75...-------
4Restaurant1/2/1723:15528:15------...0.7511110.25-
.........

<tbody>
</tbody>

As you can see, shifts starting on one day and ending the next, stay on one line, and I take care of these in the following summary:

ABCDE
1Choose a Department:Bar
2Ref. Current DayRef. Previous DayDateHourLabor Hours
3F:FAD:AD1/1/1700:00-
4G:GAE:AE1/1/1701:000.75
5H:HAF:AF1/1/1702:001.50
6I:IAG:AG1/1/1703:002.00
...

<tbody>
</tbody>

I am using two SUMIFS statements with INDIRECT in the Labor Hours Column E here in order to reference the appropriate rows and columns from the previous table with every shift. This way we get all hour portions where the shift started on that day, along with any hours where the shift started on the previous day.

Then after all this, I have a final Summary page where I just choose a time period, like a certain week, and then it flows up nicely to show all labor hours for each day in that week.

How can I cut down this process? Am I missing some useful aspect of Excel's normal pivot tables in order to streamline these calculations? I really want to avoid using hundreds of thousands of IF statements, MIN statements, and then thousands of double SUMIFS with INDIRECT, etc...

I appreciate any insight you can give :)
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
For your desired output, you would need to Unpivot the Calculated Hour section of your table.
 
Upvote 0

Forum statistics

Threads
1,215,073
Messages
6,122,975
Members
449,095
Latest member
Mr Hughes

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top