Hours worked over base - excel-formula

I have been stuck writing a formula for the below
45 HOURS * 52 WEEKS DIVIDED BY 12 MONTHS
I need this represented in hours so we can calculate our drivers overtime over their base hours
Attempted
(45/52)/12 but know its wrong

Related

Why is my process of finding the number of integer years, integer months, and integer days from the number of days not working?

I need to find out the number of integer years, number of integer months, and number of integer days from the number of days, given as an input. However, my process is not working. I am getting the wrong answer.
Note: Assume, each year to be 365 days and each month to be 30 days. Also, please do not consider leap years.
user=int(input("Please enter the number of days: "))
def year(num):
year=int(num/365)
month=int((num%365)/30)
day=num%30
print(f"{year} years, {month} months and {day} days")
year(user)
I am getting 11 years, 10 months and 10 days as the output. However, the question prompt also gave me some sample outputs. In their sample output the output for 4330 was 11 years, 10 months and 15 days. Why are we getting different outputs? My code is flawless. I am getting what I expected to get. However, my expected output is not matching with the output given in my prompt.
I'm not sure why you're calculating the number of days using day=int((((num/365-int(num/365))*12)-month)*30), which I can't understand logically. A very simple, readable way would be:
def year(num):
year=num//365
month=(num%365)//30
day=num-(year*365)-(month*30)
print(f"{year} years, {month} months and {day} days")
year(4330) # prints 11 years, 10 months and 15 days
Edit:
day=num%30 wouldn't work, because it doesn't factor in the fact that an year has 365 days. Consider num = 730, which is 2 years and 0 days. Using your formula, you'll get day = 10, which is wrong.

Excel - Dividing total to a range of cells

I have a issue with my excel project. What I want to do is to divide number of working hours to cells when particular person has a working day. Right now I use QUOTIENT formula with combination with others but the problem is I'm not getting the right split of the total. So set up looks like that
Number of hours = 72
Number of Working days = 7
So I need to divide 72/7 but I need to have the result rounded to full figure (hour). So for example I need day 1 = 10h day 2=12h and day 3 to 7 each = 10h. The QUOTIENT is resulting 10h in every single day giving me result of total 70 not 72.
The problem is that the variables will change when the employee will be switched so for example the next employee will have 94 hours and 11 days. Generally its look like that that I have range of full month so from 1 to 31 and the working days are collected from "working schedule". The idea is to sum up the hours to a month normative working hours. So for example employee has 104 hours and he is working 12 days in working schedule but the monthly norm is 176 so we have 72 hours missing and those hours should be added to those days that he is working.
Example.
You can use MOD function to calculate the remainder.
so day 1 and 3 to 7 should have =quotient(72,7)
and day 2 should have =quotient(72,7)+mod(72,7)
I suppose from your question that you want the remaining hours to be added to day 2.

convert, round, and multiply/divide in excel

We're doing an overtime incentive where people can earn raffle tickets based on the number of extra hours they work. They earn one ticket for every seven hours of overtime they work. I've built an excel sheet that I can just import the total hours into to track this, but I'm having trouble with the "number of tickets earned" formula.
I have a column for the number of hours over 40 worked, then a column to convert the hours to a number then divide by seven using: =((C2-INT(C2))*24)/7. Next column, I have =ROUNDDOWN(D2, -0.5) because if they worked 15 hours, it was giving them 2.5 tickets.
The issue I'm running into is that when they worked exactly 7 hours, I get 0 for the =ROUNDDOWN(D2, -0.5) formula. I tried =ROUND(D18, -0.5) but if they worked 6 hours 30 minutes, it gives them one ticket. I'm sure I'm probably missing something simple but is anyone able to help?
You have already used INT, which would be a better option than ROUND or ROUNDDOWN. Also C2-INT(C2) can be simplified to MOD(C2,1):
=INT(24*MOD(C2,1)/7)
Breaking it down:
MOD(C2,1) take the decimal portion of C2 (i.e. Hours, less than 24)
24*MOD(C2,1) convert from fraction-of-day to full hours
24*MOD(C2,1)/7 divide by 7. For 6.5 this gives 0.928... and for 15 it gives 2.142...
INT(24*MOD(C2,1)/7) take only the Integer part. For 6.5 this gives 0, for 15 it gives 2
I think your problem is the -0.5 argument of the ROUNDDOWN function. Why do you want to round to negative one half decimal places?
Just use ROUNDDOWN(D2,0).
Edit: I'm not sure why Agent 7 and Agent 8 have different numbers of tickets if they both worked exactly 7 hours overtime. Is the 7:00 a rounded number?
Assuming overtime is in column C, you could use:
=ROUND((HOUR(C1) + IF(MINUTE(C1)<30,0,1)) / 7, 0)
This should yield the correct number of tickets if you want to round up the hour when they are over 30 minutes. Otherwise, you could just take out the IF / MINUTE section and it will only count complete hours.

Deduct from total pool of hours and minutes in Excel

I am trying to have a cell which has a given number of hours and minutes allocated and then add events which deduct from that time and show the total hours and minutes left. For example if I had 240 hours & 40 minutes and took 40 minute appointment and another 36 minute appointment I should be left with 239 hours and 24 minutes. But I am doing something wrong with my excel formula, is there another better way of doing this?
Try something like this
=E3-SUM(E4:E11)
You also need to list your times as hh:mm:ss
E4 should be 00:40:00, E5 should be 00:36:00. They way you have them, it looks
like 40 seconds and 36 seconds (depending on formatting)
Also note that working with days you must multiply by 24 and hours multiply by 60

Subtract time from duration only if above specified amount

Working on a timesheet (duplicate of sheet 1 in link).
The current function to handle the calculations is:
B4=6:00am
C4=6:00pm
X4=0:30:00
=IF(OR(B4="",C4=""),"",IFERROR(C4-B4-X4,""))
The thing is we don't subtract 30 minutes for lunch unless an employee works longer than 6 hours and 15 minutes.
How can I fix my function to only subtract 30 mins for lunch if the total time for that day is over 6 hours and 15 mins?
Provided there is no risk of times spanning midnight, please try:
=IF(OR(B4="",C4=""),"",IF(C4-B4>6.25/24,C4-B4-X4,C4-B4))

Resources