Calculating regular hours and night hours between time and dates - excel

i have got a problem in where i try to make an excel spreadsheet to keep track of my wage and that i am paid the correct amount.
I recieve different rates depending on the time of day. I get X during the day and Y during the night which is from 23:00 (11PM) Which means if i show up to work at 16:00 (4PM) and leave at 1:15 (01:15AM) i should get 7 hours at X rate and 2.25 hours at Y rate.
However i can't seem to figure out how to format my cells in excel so that they take and Check in time and a check out time. And then figure out how many regular hours and how many night hours are in it.
Snip of data sample

Related

I produce 365 items in one hour and 4000 in 10.95 hour how to set when it will complet by time

Let's say i logged in today 9:00 AM and end up 5:00 PM i have to produce 4000 items i know it will exceed the time because my software will stop working at 5 PM so tomorrow when i start working again what would be date and time of completion work
What i did
bring working hour =SUM(B2-A2)
total complete work=ROUND(D2/C2, 2)
If i understood correctly you can use the simple difference of times and correct formatting for the time cells to get the remaining hours
The Formula in cell C5 is simple =C1-C3
The formatting applied to the cells is as below
10.95 hours is equal to 10 hours and 57 (95% of 60) minutes
You can write 10:57:00 instead of 10.95
To convert the time to again a number you can divide the time by 0.041666667 and set the format to general

Specific overtime calculation

I'm working on a simple timesheet that should calculate overtime1 and overtime2, I just cant figure out a good way to fix it.
Normal workday on 8hrs from 07:00 to 17:00 give no overtime (eg 07:00 to 16:00 or 08:00 to 17:00), but when time exceeds 8 hours I would like to get the exceeding hours in a cell.
My business rules are:
1) Any work greater than 8 hours between the hours of 06:00 to 20:00 get paid as overtime1.
2) Any work less than 8 hours will not generate any overtime2 even if after 20:00
3) Any work performed earlier than 06:00 or later than 20:00 get paid at the overtime2 rate.
Example 1: Working from 07:00 to 18:00 would get a value of 3 hours of overtime1
Example 2: Working from 14:00 to 22:00 would generate 0 hours of overtime2.
Example 3: Working 05:00 to 21:00 would give overtime1 6 hours and overtime2 2 hours (1 hour before 06:00, 1 hour after 20:00).
This is a pretty easy problem to solve if your data is laid out smartly. With column A as clock in time and column B as clock out time, use this formula as a helper to determine if you should use the clock in time or your base of 06:00:
=IF(A1-FLOOR(A1,2)<6/24,6/24,A1-FLOOR(A1,2))
Then use this formula to determine if you should use clock out time or 20:00:
=IF(B1-FLOOR(B1,2)>20/24,20/24,B1-FLOOR(B1,2))
Then you subtract the two to get fractions of a day, multiply by 24 to convert to hours, then subtract 8 to get hours of overtime1. Combined in a super formula it looks like this in C1:
OT1: =IF(OR(ISBLANK(A1),ISBLANK(B1)),"",(IF(B1-FLOOR(B1,2)>20/24,20/24,B1-FLOOR(B1,2))-IF(A1-FLOOR(A1,2)<6/24,6/24,A1-FLOOR(A1,2)))*24-8)
Remember, Excel formats dates where 1 = 24 hours. Also, I added in an OR(ISBLANK(A1),ISBLANK(B1)) statement to make sure you get a null string if one of the values is blank.
Starting on the overtime2, you need to split it into two parts: before 06:00 and after 20:00. The first part checks if the clock in time is earlier than 06:00 and if so figures out how many hours. The formula ultimately ends up being:
=IF(IF(A1-FLOOR(A1,2)<6/24,6/24,A1-FLOOR(A1,2))<=6/24,(6/24-(A1-FLOOR(A1,2)))*24,0)
For after 20:00, the same pattern is used. Figure out how many parts of a day were logged after 20:00. The final formula ends up being:
=IF(IF(B1-FLOOR(B1,2)>20/24,20/24,B1-FLOOR(B1,2))>=20/24,((B1-FLOOR(B1,2))-20/24)*24,0)
Finally, to figure out the total number of overtime 2, just add the two formulas together in D1:
OT2: =IF(OR(ISBLANK(A1),ISBLANK(B1)),"",IF(IF(A1-FLOOR(A1,2)<6/24,6/24,A1-FLOOR(A1,2))<=6/24,(6/24-(A1-FLOOR(A1,2)))*24,0)+IF(IF(B1-FLOOR(B1,2)>20/24,20/24,B1-FLOOR(B1,2))>=20/24,((B1-FLOOR(B1,2))-20/24)*24,0))
It's just about getting the logic right and understanding that Excel treats 07:00 as a decimal equal to 7/24, for example.
OT1
=IF(NOT(AND(Sheet1!$A2>=7/24,Sheet1!$B2<=17/24)),MIN(20/24,Sheet1!$B2)-Sheet1!$A2-9/24,0)
OT2
=IF(MIN(20/24,Sheet1!$B2)-Sheet1!$A2-9/24,MAX(B2-20/24,0),0)

Excel function to create due dates that land on a business day

I'm stuck creating a formula that will calculate days before the end of the month then adjust to make sure it is a business day. For example: 30 days before 6/30/2015 is 5/31/2015 which is a Sunday. I need that to adjust to the Friday before.
I'm working on finding the due dates of a number of documents that are due a certain number of days before another date. For example: documents are due 30 days before the last day of the month. However, the number of days varies and the due date needs to fall on a business day (Monday-Friday). Sometimes it's 30 days, sometimes it's 60 days, sometimes it's 30 calendar days + 5 business days, etc.
I've been able to calculate 30 days + 5 business days with the following formula:
=workday(start_date-30,-5)
Any ideas how to adjust this so that I can just have the due date be 30 calendar days before a certain date but also always be a business day?
Using WORKDAY you can use a formula like this:
=WORKDAY(A1+B1+1,-1)
where A1 is your start date and B1 the number of days to add.
You probably need to write a macro function or maybe some nested IF statements in your cell's formula.
Take a look at http://www.mrexcel.com/forum/excel-questions/481558-round-date-nearest-workday.html
That solution moves forward to the nearest workday, but the principle is sound: just subtract instead of add.

Excel - Find if worker has worked certain OT if weekday and or Sunday

I have a worksheet with days running along the columns, within each day there are different hourly categories, 130%, 150%, 200% and 215% etc, there are other categories within each day, but these are not to be included. (Can't post Image as new, can email?)
If a worker works over 3.5 hours in any of these categories they get an extra lunch, except on Sunday's where they must work 4 hours.
I've been using countif's to check each day over 3.5, and another column for Sunday's.
The weekday and Sunday can be combined into the same column as the lunch price is still the same, just number of working hours different.
The main problem is I have to adjust the countif's every month, I want something that will look at days of the week and/or sunday's and check without adjusting every month.
Have been trying to get my head around sumproduct with countif!
Any help, very much appreciated.
Thanks!
Since you have not mentioned what is where this might take some adjustment, but may get you started:
=IF(SUM(B3:G3)>=IF(WEEKDAY(B$1)=1,4,3.5),"lunch","no lunch")

Calculating Over Time and Late Time payments in excel

I need some help with a formula to automate my over-time and late time salary calculations. I get a report from our system which is in the following format:
"In Time" "Out Time" "Late" "Early" "OT"
All of these have values in the hh:mm:ss format however the cell is formatted as General.
The In Time has the time of the day I punch in.
The Out Time has the time of the day I punch out.
Late has the number of minutes I am late by from my check in time i.e. 10:00 not 10:15.
Early has the number of minutes I am early by.
OT has the number of hours and minutes I a work beyond my shift end time i.e. 6:00
I was hoping to get one column to tell me how much my salary would be deducted if I am late by x minutes. To give you an example, my day starts at 10:00 and I can come as late as 10:15 without any deductions. However for every minute I am late after that, I get a deduction which is calculated by the number of minutes I am late multiplied by my per minute salary ((((10000/30)/8)/60).
And in the second column, I was hoping to calculate how much additional salary I would get for my over time. For example, my shift ends at 6:00 and for every minute after 6:00 I am entitled to over time, which is calculated by the number of minutes I work over time multiples by my per minute over time rate (30/60).
Please let me know if you guys could help me with this. This could be used by almost anyone who wants to make sure their salary is calculated correctly.
"What I really need help with, is the formula for the Late Deduction and Overtime Calculations"
As I implied in my comments, the format of your data is all important. Excel stores times as fractions of a day. So 1 minute = 1/60/24
If you convert ÿour data to a normal Excel time, then the formulas for your Late Deductions and Overtime compensation would be as below. Where Late is the number of minutes you are late (stored as an Excel Time); and OT is the number of overtime minutes.
If these values are stored as plain numbers, omit the 24*60 feature. If these values are stored as Text, you need to change them to either regular numbers or fractions of a day. Exactly how to change them depends on what is making them appear as text.
Late Deduction
=MAX(0,24*60*Late-15)*PerMinuteSalary
Overtime
=24*60*OT*PerMinuteOvertimeSalary

Resources