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.
Related
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
I'm having a hard time getting my head around what I think is a simple enough problem.
I have an Excel table of hours by day for each user i.e.:
Date1, Date1+1, Date1+2, Date1+3,... Date1+n
User1 8 8 4 6 ... 2
User2 5 2 8 3 ... 7
User3 0 7 5 0 ... 8
For forecasting purposes this grid looks several months into the future.
I do my work daily, others want it by week. I'd like to automatically generate the same table of data but rolled up by WeekNum.
I tried setting a year-weeknum at the top of the daily table and then using a SumIfs function to compare the user name and week num to sum up the daily hours in another tab for weekly data but I just couldn't get it to function properly.
=SUMIFS('Act - Forecast Hours'!$G$6:$AAL$35,'Act - Forecast Hours'!$A26,$A25,'Act - Forecast Hours'!S$4,O$3)
I think I'm overcomplicating a solution, any help is appreciated.
TIA
Rob
OK, I may have come up with an approach.
Since on my main Hourly Sheet the format is fixed, i.e. each week is 7 days and increments.
I setup a second sheet where I called a vertical and a horizontal offset and used the following formula:
=SUM(OFFSET('Act - Forecast Hours'!$G$9,$A5,D$2,1,7))
$A5 and D$2 refer to offset counts that increment by 7. As you copy the formula to each cell it increments the Row / Column to point to the right spot. Then for the Height and Width I look at a grid 1 row high and 7 wide to select each day of the week.
It works, I'm happy. I'm certainly interested in a more refined approach if there is one :-)
Thank You to anyone that does read through the question!
Regards
Rob
The excel user will export the data from an online website to excel (12 months data), so the data will be all the time different.
I need the past 6 months and 12 months average (However, the calculation need to use the months I have in the data, and sometimes there will be less then 6 or 12 months), but I still need to get the average and frequency for it , however, I am not sure how to get it.
I am trying to write a code, but it is not complete and is not working as well, I don't get an error; it just doesn't work.
I am open for Excel formulas as well, the problem may be the last row and that it need to use the data I have to calculate and not 6 and 12 months full.
PS: I post a similar question on https://www.ozgrid.com/forum/index.php?thread/1227312-dynamic-way-to-calculate-the-last-6-months-average/
Will This formulas work for you?
Average for last 6 months:
=AVERAGEIF(A:A;">="&EDATE(MAX(A:A);-6);B:B)
Frequency for last 6 months:
=IF(MONTH(MAX(A:A)-MIN(A:A))>=6;COUNTIF(A:A;">="&EDATE(MAX(A:A);-6))/6;COUNTIF(A:A;">="&MIN(A:A))/MONTH(MAX(A:A)-MIN(A:A)))
Average for last 12 months:
=AVERAGEIF(A:A;">="&EDATE(MAX(A:A);-12);B:B)
Frequency for last 12 months:
=IF(MONTH(MAX(A:A)-MIN(A:A))>=12;COUNTIF(A:A;">="&EDATE(MAX(A:A);-12))/12;COUNTIF(A:A;">="&MIN(A:A))/MONTH(MAX(A:A)-MIN(A:A)))
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.
I want to distribute a certain value (D4:D6) equally over the week-numbers (E3:J3) by its start- and end-date (B4:C6), as shown in the example.
A formula/vba script should do the following things:
Check which week-number the start- and end-date has
Divide the value by the amount of weeks between start- and end-date
Place the values in the matching column in the same row
The example in text format to copy:
2017 2018
Start End Value 50 51 52 1 2 3
26.12.2017 04.01.2018 20 - - 10 10 - -
12.12.2017 24.12.2017 50 25 25 - - - -
11.12.2017 10.01.2018 60 12 12 12 12 12 -
Also glad about hints / ideas how single steps could be achieved.
Proof of Concept:
place the following formula in E4 and copy down and right
=IF(WEEKNUM($C4,21)-WEEKNUM($B4,21)<0,IF(OR(E$3>=WEEKNUM($B4,21),E$3<=WEEKNUM($C4,21)),$D4/IF(WEEKNUM($C4,21)-WEEKNUM($B4,21)<0,MAX(WEEKNUM(DATE(YEAR($B4),12,{28,29,30,31}),21))-WEEKNUM($B4,21)+WEEKNUM($C4,21)+1,WEEKNUM($C4,21)-WEEKNUM($B4,21)+1),0),IF(AND(E$3>=WEEKNUM($B4,21),E$3<=WEEKNUM($C4,21)),$D4/IF(WEEKNUM($C4,21)-WEEKNUM($B4,21)<0,MAX(WEEKNUM(DATE(YEAR($B4),12,{28,29,30,31}),21))-WEEKNUM($B4,21)+WEEKNUM($C4,21)+1,WEEKNUM($C4,21)-WEEKNUM($B4,21)+1),0))
Now this is a built up formula from multiple cells that I back substitute the formulas to wind up with the monstrosity above. The break down is as follows.
STEP 1
Find the start week number. Place the following in B8.
=WEEKNUM($B4,21)
STEP 2
Find the end week number. Place the following in C8.
=WEEKNUM($C4,21)
STEP 3
Determine the maximum number of weeks in a year. Thanks to Ron Rosenfeld for this formula. Place the following in D8.
=MAX(WEEKNUM(DATE(YEAR($B4),12,{28,29,30,31}),21))
STEP 4
Determine if the week is in the same year or the following year. Place the following in E8.
=C8-B8
STEP 5
Determine the number of weeks. Place the following in F8.
=IF(E8<0,D8-B8+C8+1,C8-B8+1)
STEP 6
Average the value for each week. Place the following in G8.
=D4/F8
STEP 7
Determine if the average value belongs to a date header or the value of 0 (if you want an actual dash and not just formatting 0 as a dash then change 0 to -. Place the following formula in H8.
=IF($E8<0,IF(OR(E$3>=$B8,E$3<=$C8),$G8,0),IF(AND(E$3>=$B8,E$3<=$C8),$G8,0))
Copy the H8 formula to the right and down as required.
Caveat: Will work for a 1 year spread in work weeks. I have serious doubts that it would work over multi year start and end week.
Layout of steps