View Single Post
  #1   Report Post  
leo leo is offline
Junior Member
 
Posts: 6
Default sliding hours payment

For a medical team that is scheduled 24*7, each medic gets paid for the hours they work. Some hours however get paid extra on top of their hourly rate.
so, 0:00 - 06:00 have different uplifts then 06:00 - 08:00 and so forth.
I have A3 = shifthour-start B3 = shifthour end, C3 - shifthours total
(infact b3-c3)
then I have 24 columns with heading
d1 0:00 e1 01:00 f1 02:00
d2 01:00 e2 02:00 f2 03:00 and so forth.
all I want is to have line three populate with the minutes within that hour that was worked.

as example a medic worked from 0:40 -2:00.
cell d3 should get 0:20 (from 0:40-01:00)
cell e3 should get 1:00 (from 1:00-2:00)
cell d3 should get 0:00 (shift ended at 02:00)

I got it working in cell d3 by entering

+IF($AC12-$AB12=0;"";ABS(IF(AND($AB12=AT$9;$AB12AT$8;$AC12=A T$9;$AC12=AT$8);+$AC12-$AB12;0)+IF(AND($AB12=AT$8;$AC12=AT$8;$AB12=AT$9;$ AC12AT$9);$AC12-AT$8;0)+IF(AND($AB12AT$8;$AC12AT$9;$AB12=AT$9;$AC1 2=AT$8);AT$9-$AB12;0))+IF(AND($AB12=AT$8;$AC12=AT$9;$AB12=AT$9; $AC12=AT$8);+AT$9-AT$8;0))

where BC12 = a3
where AC12 = b3
where AT8 = d1
where AT9 = d2

I think this statement is a bit long (255 characters). is there shorter way?

Thanks

Leo