Formula Help

Jerzydon

New Member
Joined
Jul 26, 2018
Messages
9
[FONT=&quot]I have a spreadsheet that I’m using to calculate hours worked. column headings are ”Clock In”, “Meal Hour 1”, “Meal Hour 2”, “Meal Hour 3”, ”Meal Hour 4“ & “Clock Out”. After the clock out time there are Stright Time Hours Worked, Time & 1/2 Hours Worked, and Doubletime Hours worked. I want to use a formula that will automatically calculate the correct number of hours for each heading. [/FONT]
[FONT=&quot]
[/FONT]

[FONT=&quot]Straight Time are any hours worked between 8am-12pm, and 1pm-5pm. [/FONT]
[FONT=&quot]Time & 1/2 are any hours worked between 7am-8am, 5pm-6pm, 7pm-12pm, & 1am-6am. [/FONT]
[FONT=&quot]Double Time are any hours worked during those breaks which are 6am-7am, 12pm-1pm, 6pm-7pm and 12am-1am. [/FONT]
[FONT=&quot]
[/FONT]

[FONT=&quot]Right now I manually calculate the hours for each and fill it in but I would like to automate that process if at all possible using the clock in and clock out fields. I’ve tried conjunctive IF statements and AND/OR but I’ve had no luck. Can anyone point me in the right direction?[/FONT]
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
Hi

It would help posters develop a solution if they can see sample data in your sheet layout.
 
Upvote 0
Saturday and Sunday are all overtime hours as well.
[FONT=&quot]Date[/FONT]
[FONT=&quot]Clock-In[/FONT]
[FONT=&quot]Worked Meal Hour 06-0700[/FONT]
[FONT=&quot]Worked Meal Hour 12-1300[/FONT]
[FONT=&quot]Worked Meal Hour 18-1900[/FONT]
[FONT=&quot]Worked Meal Hour 00-0100[/FONT]
[FONT=&quot]Clock-Out[/FONT]
[FONT=&quot]Straight Time Hours Worked[/FONT]
[FONT=&quot]Time & 1/2 Hours Worked[/FONT]
[FONT=&quot]Double Time Hours Worked[/FONT]
[FONT=&quot]Week 1 Start[/FONT]


















[FONT=&quot]Jul 16, 2018[/FONT]


















[FONT=&quot]Jul 17, 2018[/FONT]
[FONT=&quot]8:00 AM[/FONT]
[FONT=&quot]No[/FONT]
[FONT=&quot]No[/FONT]
[FONT=&quot]No[/FONT]
[FONT=&quot]No[/FONT]
[FONT=&quot]4:00 PM[/FONT]
[FONT=&quot]7[/FONT]
[FONT=&quot]0[/FONT]
[FONT=&quot]0[/FONT]
[FONT=&quot]Jul 18, 2018[/FONT]
[FONT=&quot]7:00 PM[/FONT]
[FONT=&quot]No[/FONT]
[FONT=&quot]No[/FONT]
[FONT=&quot]No[/FONT]
[FONT=&quot]Yes[/FONT]
[FONT=&quot]3:00 AM[/FONT]
[FONT=&quot]0[/FONT]
[FONT=&quot]7[/FONT]
[FONT=&quot]1[/FONT]
[FONT=&quot]Jul 19, 2018[/FONT]
[FONT=&quot]8:00 AM[/FONT]
[FONT=&quot]No[/FONT]
[FONT=&quot]Yes[/FONT]
[FONT=&quot]No[/FONT]
[FONT=&quot]No[/FONT]
[FONT=&quot]3:00 PM[/FONT]
[FONT=&quot]6[/FONT]
[FONT=&quot]0[/FONT]
[FONT=&quot]1[/FONT]
[FONT=&quot]Jul 20, 2018[/FONT]
[FONT=&quot]7:00 AM[/FONT]
[FONT=&quot]No[/FONT]
[FONT=&quot]No[/FONT]
[FONT=&quot]Yes[/FONT]
[FONT=&quot]No[/FONT]
[FONT=&quot]7:00 PM[/FONT]
[FONT=&quot]8[/FONT]
[FONT=&quot]2[/FONT]
[FONT=&quot]1[/FONT]
[FONT=&quot]Jul 21, 2018[/FONT]
[FONT=&quot]7:00 AM[/FONT]
[FONT=&quot]No[/FONT]
[FONT=&quot]Yes[/FONT]
[FONT=&quot]No[/FONT]
[FONT=&quot]No[/FONT]
[FONT=&quot]4:00 PM[/FONT]
[FONT=&quot]0[/FONT]
[FONT=&quot]9h[/FONT]
[FONT=&quot]1[/FONT]
[FONT=&quot]Jul 22, 2018[/FONT]


[FONT=&quot]No[/FONT]
[FONT=&quot]No[/FONT]
[FONT=&quot]No[/FONT]
[FONT=&quot]No[/FONT]


[FONT=&quot]0[/FONT]
[FONT=&quot]0[/FONT]
[FONT=&quot]0[/FONT]
[FONT=&quot]Week 1 End[/FONT]












[FONT=&quot]21[/FONT]


[FONT=&quot]4[/FONT]




















[FONT=&quot]Week 2 Start[/FONT]


















[FONT=&quot]Jul 23, 2018[/FONT]
[FONT=&quot]7:00 AM[/FONT]
[FONT=&quot]No[/FONT]
[FONT=&quot]Yes[/FONT]
[FONT=&quot]No[/FONT]
[FONT=&quot]No[/FONT]
[FONT=&quot]4:00 PM[/FONT]
[FONT=&quot]7[/FONT]
[FONT=&quot]1[/FONT]
[FONT=&quot]1[/FONT]
[FONT=&quot]Jul 24, 2018[/FONT]
[FONT=&quot]7:00 AM[/FONT]
[FONT=&quot]No[/FONT]
[FONT=&quot]No[/FONT]
[FONT=&quot]No[/FONT]
[FONT=&quot]No[/FONT]
[FONT=&quot]4:00 PM[/FONT]
[FONT=&quot]8[/FONT]
[FONT=&quot]1[/FONT]
[FONT=&quot]0[/FONT]
[FONT=&quot]Jul 25, 2018[/FONT]
[FONT=&quot]8:00 AM[/FONT]
[FONT=&quot]No[/FONT]
[FONT=&quot]No[/FONT]
[FONT=&quot]Yes[/FONT]
[FONT=&quot]No[/FONT]
[FONT=&quot]11:00 PM[/FONT]
[FONT=&quot]8[/FONT]
[FONT=&quot]5[/FONT]
[FONT=&quot]1[/FONT]
[FONT=&quot]Jul 26, 2018[/FONT]
[FONT=&quot]8:00 AM[/FONT]
[FONT=&quot]No[/FONT]
[FONT=&quot]No[/FONT]
[FONT=&quot]No[/FONT]
[FONT=&quot]No[/FONT]
[FONT=&quot]3:00 PM[/FONT]
[FONT=&quot]6[/FONT]
[FONT=&quot]0[/FONT]
[FONT=&quot]0[/FONT]
[FONT=&quot]Jul 27, 2018[/FONT]
[FONT=&quot]1:00 PM[/FONT]
[FONT=&quot]No[/FONT]
[FONT=&quot]No[/FONT]
[FONT=&quot]No[/FONT]
[FONT=&quot]No[/FONT]
[FONT=&quot]5:00 PM[/FONT]
[FONT=&quot]4[/FONT]
[FONT=&quot]0[/FONT]
[FONT=&quot]0[/FONT]
[FONT=&quot]Jul 28, 2018[/FONT]












[FONT=&quot]0[/FONT]
[FONT=&quot]0[/FONT]
[FONT=&quot]0[/FONT]
[FONT=&quot]Jul 29, 2018[/FONT]














[FONT=&quot]0[/FONT]
[FONT=&quot]0[/FONT]
[FONT=&quot]Week 2 End[/FONT]












[FONT=&quot]33[/FONT]
[FONT=&quot]7[/FONT]
[FONT=&quot]2[/FONT]

<tbody> </tbody>

 
Upvote 0
In the first table, there is a 9h. Is that a mistake? Should that row be 7 1 1.
From 7 am to 4 pm, how can there be 8 straight hours? Shouldn't it be only 7?

If I am right, I have got a solution for you.

In an obscure area of the spreadsheet, create a range like the following:

12b
23b
34b
45b
56b
67c
78b

<tbody>
</tbody>

The above is only part of the table. 1 is 1 am, 2 is 2 am and so on. I don't know you work hour range. Judging from you example, I created a 32 hour table. from 1 am to 8 am of the next day. If the work hour spans more than that, you create a bigger table., 48 hours, maybe. Here, a is straight hour, b is half, and c is double. The first two columns are for illustration purpose only. You don't actually need them.

Now, you only need to count the number of a and b in the working period. C is entered manually. So, just count "Yes" in column C, D, E, and F.

To count C, use the formula "=COUNTIF(C4:F4,"=Yes")".

To count a, use the formula "=COUNTIF(INDEX($R$1:$R$32, $B4*24):INDEX($R$1:$R$32,IF($G4<$B4, $G4*24+23,$G4*24-1)), "a")".

To count b, change the "a" to "b".

R is the column where a, b, and c reside. If your table is in a different place, you need to change R to suit your need.
 
Last edited:
Upvote 0
The 9 would be correct because Saturday and Sunday are all Time and 1/2 and the meal hours are Double. There are no straight Time Hours on the weekend.
 
Upvote 0
That adds a whole new level of complexity. It's no too difficult to solve except when there are works spanning from Friday to Saturday or Sunday to Monday. Are such cases possible?
 
Upvote 0
It is possible. There’s no set timeframe. It’s a “work until finished” schedule so it can go on for any amount of time until the workload isn’t complete. Ikniw there is a formula that can be used to give the correct time when a day runs into another one, I’m just not sure how to structure the combination of formulas to give me the proper result.

I do do appreciate all of the input and assistance.
 
Upvote 0
Doesn't labor law dictate how long a shift can be? What is the longest shift? Judging from what you said, there are four scenarios here, Friday, Saturday, Sunday, and Monday to Thursday. The formula will be quite long. I'm trying to see if there is a way to simplify it. For example, if work starting on Sunday will not exceed 8 AM on Monday, then, Saturday and Sunday collapse into one scenario, not two. So, there are only three scenarios to consider.

You said there is a formula to give the correct hours when shift spans over midnight. What is the formula?
 
Upvote 0

Forum statistics

Threads
1,215,488
Messages
6,125,092
Members
449,206
Latest member
ralemanygarcia

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