Excel formula help

OGroteKoning

Honorary Master
Joined
Apr 8, 2011
Messages
10,741
Reaction score
4
Location
Pretoria
I am struggling to create formulas for this scenarion. Help would be appreciated.

It was agreed that XYZ company would be compensated for their staff on an actual basis. XYZ claimed the hours as per the green block. The correct calculation for the hours are in the red block (hand calculated - there could be some errors). The principle of payment is that XYZ would be compensated for 160 normal hours and 54 overtime hours per month. All hours worked over and above this agreement will be compensated at the agreed overtime rates:
Normal hours - Rate x 1.0
Type 1 OT hours - Rate x 1.5
Type 2 OT hours - Rate x 2.0
Type 3 OT hours - Rate x 2.5
Type 4 OT hours - Rate x 1.33

The principle is that XYZ has to "fill in" the 160 and 54 hours before any other overtime hours can be claimed.
Jack (Line 4) has worked all the alotted normal hours and more than his alotted overtime hours, therefor all hours claimed would be acceptable.
John (line 5) has not worked his full alotted normal hours and therefor some of his overtime hours must "fill in" the norml hours first, thereby reducing his OT hours.
Anne (Line 10) has not worked her full alotted normal hours and therefor forfeit all overtime hours.
Hours forfeited will start with the most expensive hours.

I need a formula for each of the columns F, G, H and I.

Calc Hours.PNG
 
[F4]=IF(SUM(B4:E4)>=160,160,SUM(B4:E4))
[G4]=IF((160-B4-D4)>=C4,0,C4-IF((160-B4-D4)<=0,0,(160-B4-D4)))
[H4]=IF(160-B4>=D4,0,D4-(160-B4))
[I4]=IF(SUM(B4:'D4)>=160,E4,IF((160-B4-C4-D4)>=E4,0,(160-B4-C4-D4)))

Bit cumbersome, but these should work as long as things remain constant

Just remove the apostrophe from the 4th one. (there to prevent a smiley)
 
Last edited:
Thanks matey! Good news so far ... it checks out in the example 100%. Now for my real life application...
 
Bit cumbersome, but these should work as long as things remain constant

Just remove the apostrophe from the 4th one. (there to prevent a smiley)

The results in the column H produced negative values under certain circumstances. I don't have too much time to investigate exactly right now, so as an interim measure, I just wrapped it with an If statement to make it 0 if it is smaller than 0

But it all works thanks!
 
The results in the column H produced negative values under certain circumstances. I don't have too much time to investigate exactly right now, so as an interim measure, I just wrapped it with an If statement to make it 0 if it is smaller than 0

But it all works thanks!

Glad to be of service.

Excel is my bread and butter so to speak.
 
Top
Sign up to the MyBroadband newsletter
X