December 21, 2019
I need to get a sum total that is dependent on another cell. In my example, I am totaling the number of "Standard" hours (up to a total of 40) and "Overtime" (over 40 hours) for each job number. A person may work on multiple jobs per day. We have a process in place to calculate this. No advice needed on this part.
1. I have tried to change the format. The bookkeeper is old and set in her ways. The format will not change.
2. We have 100's of potential job numbers so adding static cells won't be feasible. The line in which the job number is located will constantly be changing throughout the year.
The part that I am missing is the weekly total for each job number - the part highlighted in yellow. What formula needs to be put in the yellow cells in order to get the total I am looking for?
Thank you in advance for your help!
June 25, 2016
December 21, 2019
December 20, 2019
The first 2 days in columns B to E dont have an overtime column, but the other 4 do - is this an error or by design?
I really dont like this formula but with the constraints you specify and the inablity to change anything it might suffice
Basically it is just 6 sumifs added together - 1 for each day. Then wrapped around an if statment to max out if the standard hours are greater than 40. I got stuck at this part as i wasnt sure where the overtime hours come from (the J & O columns, excess hours in columns E,I & N or a combination of both)
For the unique list of jobs, i would run a quick macro as i find it less complicated than a formula (click the button on the right)
Dim op As Range
Dim opCount As Integer
Dim ip1 As Range, ip2 As Range, ip3 As Range, ip4 As Range, ip5 As Range, ip6 As Range
Set ip1 = Range("b3:b18")
Set ip2 = Range("b21:b36")
Set ip3 = Range("f3:f18")
Set ip4 = Range("f21:f36")
Set ip5 = Range("k3:k18")
Set ip6 = Range("k21:k36")
opCount = 1
'Set op = Range("T" & opCount)
ip1.Copy Range("t" & opCount)
ip2.Copy Range("t" & Cells(Rows.Count, "T").End(xlUp).Row + 1)
ip3.Copy Range("t" & Cells(Rows.Count, "T").End(xlUp).Row + 1)
ip4.Copy Range("t" & Cells(Rows.Count, "T").End(xlUp).Row + 1)
ip5.Copy Range("t" & Cells(Rows.Count, "T").End(xlUp).Row + 1)
ip6.Copy Range("t" & Cells(Rows.Count, "T").End(xlUp).Row + 1)
.RemoveDuplicates Columns:=1, Header:=xlNo
.Sort key1:=Range("T:T"), order1:=xlAscending, Header:=xlNo
As i said i dont really like either of these, but if the template cant change it might work.
June 25, 2016
I will just make the following assumption
1) There is a column F for Overtime, so I added one.
2) Maximum total "Standard" hours is 40 (I hope that is what you meant).
You can give this a try. In cell I40 (after adding an additional column F) enter
The MIN formula will take the lower of the 2 values (i.e. max is 40).
Don't quite understand what you wanted for the Overtime so I don't have a solution yet.
Maybe you can give us your expected answers based on your attachment.
This will make it easier for us to understand what you are expecting the output to be.
December 7, 2016
With the current layout you can't avoid messy formulas, as you probably have guessed by now. As also already mentioned, I assume you will have a column F showing overtime for the first two days. If you only need to sum the standard and overtime hours you can use SUMPRODUCT to do that for you, else I suggest you use any other given previous suggestion.
In cell I40 (as I assume you need to add an extra column F), paste in below formula, then drag and copy as needed.
As your data is spread out the formula is a bit hard to read and understand, but the basics are as follows:
For any job number in cells B3 to B18 matching the job number in cell G40, sum the hours in cells E3 to E18, etc.
The + symbol equals OR and the * symbol equals AND.
As SUMPRODUCT is a bit more fussy about data format you can't just ask it for example to look in range B3 to B36, as that range contains both text and numbers.
I hope you will find a working solution.