Split time in to shifts

nitroxed

New Member
Joined
Oct 12, 2017
Messages
2
Hi

I have spent SO much time in Excel trying to get this to work but have failed miserably, when I think I'm there, I test it and it fails....

This is the scenario:

We pay staff weekly based on 4 different categories of shift as follows (all paid at different hourly rates) which they submit a timesheet for:

ShiftStartEnd
Mon-Fri Day06:0020:00
Mon-Fri Night20:0006:00
Saturday00:0023:59
Sunday00:0023:59

<tbody>
</tbody>

The complexity of trying to get a formula to calculate the number of hours in each category blows my mind ! For example, we might have an employee who started at 1900hrs on Friday, and finished at 0800hrs on Saturday morning. A total shift length of 13hrs. Splitting this as per the shift table above actually gives rise to the following hours and shifts:

Mon-Fri Day 1hr
Mon-Fri Night 4hrs
Saturday 8hrs

What I would like ideally is the ability to enter start times and end times in to a spreadsheet and based on this and the table above, split their time in to the respective shift categories.

Any help greatly appreciated !

Thanks
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
We pay staff weekly based on 4 different categories of shift as follows (all paid at different hourly rates) which they submit a timesheet for:01:00
ShiftStartEndrate $ / hoursun01/01/2017 00:0000:00251SunSun00:000
Mon-Fri Day06:0020:001201/01/2017 01:0001:00252SunSun01:0025
Mon-Fri Night20:0006:001401/01/2017 02:0002:00253SunSun02:0050
Saturday00:0023:591701/01/2017 03:0003:00254SunSun03:0075
Sunday00:0023:592501/01/2017 04:0004:00255SunSun04:00100
01/01/2017 05:0005:00256SunSun05:00125
employee who started at 1900hrs on Friday, and finished at 0800hrs on Saturday morning.01/01/2017 06:0006:00257SunSun06:00150
Sun01/01/2017 07:0007:00258SunSun07:00175
Mon-Fri Day 1hr01/01/2017 08:0008:00259SunSun08:00200
Mon-Fri Night 4hrs01/01/2017 09:0009:002510SunSun09:00225
Saturday 8hrs01/01/2017 10:0010:002511SunSun10:00250
01/01/2017 11:0011:002512SunSun11:00275
01/01/2017 12:0012:002513SunSun12:00300
01/01/2017 13:0013:002514SunSun13:00325
01/01/2017 14:0014:002515SunSun14:00350
01/01/2017 15:0015:002516SunSun15:00375
startfri19:00fri19:0001/01/2017 16:0016:002517SunSun16:00400
finishsat08:00sat08:0001/01/2017 17:0017:002518SunSun17:00425
pay204$01/01/2017 18:0018:002519SunSun18:00450
01/01/2017 19:0019:002520SunSun19:00475
01/01/2017 20:0020:002521SunSun20:00500
01/01/2017 21:0021:002522SunSun21:00525
01/01/2017 22:0022:002523SunSun22:00550
I made a table from sun to sun = 8 days01/01/2017 23:0023:002524SunSun23:00575
and put in the $ rate for each hourmon02/01/2017 00:0000:002525MonMon00:00600
02/01/2017 01:0001:001427MonMon01:00614
these were cumulatively summed02/01/2017 02:0002:001428MonMon02:00628
and a subtraction gives the pay02/01/2017 03:0003:001429MonMon03:00642
02/01/2017 04:0004:001430MonMon04:00656
the 204 $ comes from02/01/2017 05:0005:001431MonMon05:00670
02/01/2017 06:0006:001432MonMon06:00684
=OFFSET($L$2,MATCH(D20,$L$3:$L$999,0),1)-OFFSET($L$2,MATCH(D19,$L$3:$L$999,0),1)02/01/2017 07:0007:001233MonMon07:00696
02/01/2017 08:0008:001234MonMon08:00708
the helper table can be hidden if desired02/01/2017 09:0009:001235MonMon09:00720
02/01/2017 10:0010:001236MonMon10:00732
02/01/2017 11:0011:001237MonMon11:00744
02/01/2017 12:0012:001238MonMon12:00756
02/01/2017 13:0013:001239MonMon13:00768
02/01/2017 14:0014:001240MonMon14:00780
02/01/2017 15:0015:001241MonMon15:00792
02/01/2017 16:0016:001242MonMon16:00804
02/01/2017 17:0017:001243MonMon17:00816
02/01/2017 18:0018:001244MonMon18:00828
02/01/2017 19:0019:001245MonMon19:00840
02/01/2017 20:0020:001246MonMon20:00852
02/01/2017 21:0021:001447MonMon21:00866
02/01/2017 22:0022:001448MonMon22:00880
02/01/2017 23:0023:001449MonMon23:00894
tue02/01/2017 23:5900:001450MonTue00:00908
03/01/2017 01:0001:001452TueTue01:00922
03/01/2017 02:0002:001453TueTue02:00936
03/01/2017 03:0003:001454TueTue03:00950
03/01/2017 04:0004:001455TueTue04:00964
03/01/2017 05:0005:001456TueTue05:00978
03/01/2017 06:0006:001457TueTue06:00992
03/01/2017 07:0007:001258TueTue07:001004
03/01/2017 08:0008:001259TueTue08:001016
03/01/2017 09:0009:001260TueTue09:001028
03/01/2017 10:0010:001261TueTue10:001040
03/01/2017 11:0011:001262TueTue11:001052
03/01/2017 12:0012:001263TueTue12:001064
03/01/2017 13:0013:001264TueTue13:001076
03/01/2017 14:0014:001265TueTue14:001088
03/01/2017 15:0015:001266TueTue15:001100
03/01/2017 16:0016:001267TueTue16:001112
03/01/2017 17:0017:001268TueTue17:001124
03/01/2017 18:0018:001269TueTue18:001136
03/01/2017 19:0019:001270TueTue19:001148
03/01/2017 20:0020:001271TueTue20:001160
03/01/2017 21:0021:001472TueTue21:001174
03/01/2017 22:0022:001473TueTue22:001188
03/01/2017 23:0023:001474TueTue23:001202
wed03/01/2017 23:5900:001475TueWed00:001216
04/01/2017 01:0001:001477WedWed01:001230
04/01/2017 02:0002:001478WedWed02:001244
04/01/2017 03:0003:001479WedWed03:001258
04/01/2017 04:0004:001480WedWed04:001272
04/01/2017 05:0005:001481WedWed05:001286
04/01/2017 06:0006:001482WedWed06:001300
04/01/2017 07:0007:001283WedWed07:001312
04/01/2017 08:0008:001284WedWed08:001324
04/01/2017 09:0009:001285WedWed09:001336
04/01/2017 10:0010:001286WedWed10:001348
04/01/2017 11:0011:001287WedWed11:001360
04/01/2017 12:0012:001288WedWed12:001372
04/01/2017 13:0013:001289WedWed13:001384
04/01/2017 14:0014:001290WedWed14:001396
04/01/2017 15:0015:001291WedWed15:001408
04/01/2017 16:0016:001292WedWed16:001420
04/01/2017 17:0017:001293WedWed17:001432
04/01/2017 18:0018:001294WedWed18:001444
04/01/2017 19:0019:001295WedWed19:001456
04/01/2017 20:0020:001296WedWed20:001468
04/01/2017 21:0021:001497WedWed21:001482
04/01/2017 22:0022:001498WedWed22:001496
04/01/2017 23:0023:001499WedWed23:001510
thu04/01/2017 23:5900:0014100WedThu00:001524
05/01/2017 01:0001:0014102ThuThu01:001538
05/01/2017 02:0002:0014103ThuThu02:001552
05/01/2017 03:0003:0014104ThuThu03:001566
05/01/2017 04:0004:0014105ThuThu04:001580
05/01/2017 05:0005:0014106ThuThu05:001594
05/01/2017 06:0006:0014107ThuThu06:001608
05/01/2017 07:0007:0012108ThuThu07:001620
05/01/2017 08:0008:0012109ThuThu08:001632
05/01/2017 09:0009:0012110ThuThu09:001644
05/01/2017 10:0010:0012111ThuThu10:001656
05/01/2017 11:0011:0012112ThuThu11:001668
05/01/2017 12:0012:0012113ThuThu12:001680
05/01/2017 13:0013:0012114ThuThu13:001692
05/01/2017 14:0014:0012115ThuThu14:001704
05/01/2017 15:0015:0012116ThuThu15:001716
05/01/2017 16:0016:0012117ThuThu16:001728
05/01/2017 17:0017:0012118ThuThu17:001740
05/01/2017 18:0018:0012119ThuThu18:001752
05/01/2017 19:0019:0012120ThuThu19:001764
05/01/2017 20:0020:0012121ThuThu20:001776
05/01/2017 21:0021:0014122ThuThu21:001790
05/01/2017 22:0022:0014123ThuThu22:001804
05/01/2017 23:0023:0014124ThuThu23:001818
fri05/01/2017 23:5900:0014125ThuFri00:001832
06/01/2017 01:0001:0014127FriFri01:001846
06/01/2017 02:0002:0014128FriFri02:001860
06/01/2017 03:0003:0014129FriFri03:001874
06/01/2017 04:0004:0014130FriFri04:001888
06/01/2017 05:0005:0014131FriFri05:001902
06/01/2017 06:0006:0014132FriFri06:001916
06/01/2017 07:0007:0012133FriFri07:001928
06/01/2017 08:0008:0012134FriFri08:001940
06/01/2017 09:0009:0012135FriFri09:001952
06/01/2017 10:0010:0012136FriFri10:001964
06/01/2017 11:0011:0012137FriFri11:001976
06/01/2017 12:0012:0012138FriFri12:001988
06/01/2017 13:0013:0012139FriFri13:002000
06/01/2017 14:0014:0012140FriFri14:002012
06/01/2017 15:0015:0012141FriFri15:002024
06/01/2017 16:0016:0012142FriFri16:002036
06/01/2017 17:0017:0012143FriFri17:002048
06/01/2017 18:0018:0012144FriFri18:002060
06/01/2017 19:0019:0012145FriFri19:002072
06/01/2017 20:0020:0012146FriFri20:002084
06/01/2017 21:0021:0014147FriFri21:002098
06/01/2017 22:0022:0014148FriFri22:002112
06/01/2017 23:0023:0014149FriFri23:002126
sat06/01/2017 23:5900:0014150FriSat00:002140
07/01/2017 01:0001:0017152SatSat01:002157
07/01/2017 02:0002:0017153SatSat02:002174
07/01/2017 03:0003:0017154SatSat03:002191
07/01/2017 04:0004:0017155SatSat04:002208
07/01/2017 05:0005:0017156SatSat05:002225
07/01/2017 06:0006:0017157SatSat06:002242
07/01/2017 07:0007:0017158SatSat07:002259
07/01/2017 08:0008:0017159SatSat08:002276
07/01/2017 09:0009:0017160SatSat09:002293
07/01/2017 10:0010:0017161SatSat10:002310
07/01/2017 11:0011:0017162SatSat11:002327
07/01/2017 12:0012:0017163SatSat12:002344
07/01/2017 13:0013:0017164SatSat13:002361
07/01/2017 14:0014:0017165SatSat14:002378
07/01/2017 15:0015:0017166SatSat15:002395
07/01/2017 16:0016:0017167SatSat16:002412
07/01/2017 17:0017:0017168SatSat17:002429
07/01/2017 18:0018:0017169SatSat18:002446
07/01/2017 19:0019:0017170SatSat19:002463
07/01/2017 20:0020:0017171SatSat20:002480
07/01/2017 21:0021:0017172SatSat21:002497
07/01/2017 22:0022:0017173SatSat22:002514
07/01/2017 23:0023:0017174SatSat23:002531
satsun07/01/2017 23:5900:0017175SatSunSat00:002548
08/01/2017 01:0001:0025177SunSunSat01:002573
08/01/2017 02:0002:0025178SunSunSat02:002598
08/01/2017 03:0003:0025179SunSunSat03:002623
08/01/2017 04:0004:0025180SunSunSat04:002648
08/01/2017 05:0005:0025181SunSunSat05:002673
08/01/2017 06:0006:0025182SunSunSat06:002698
08/01/2017 07:0007:0025183SunSunSat07:002723
08/01/2017 08:0008:0025184SunSunSat08:002748
08/01/2017 09:0009:0025185SunSunSat09:002773
08/01/2017 10:0010:0025186SunSunSat10:002798
08/01/2017 11:0011:0025187SunSunSat11:002823
08/01/2017 12:0012:0025188SunSunSat12:002848
08/01/2017 13:0013:0025189SunSunSat13:002873
08/01/2017 14:0014:0025190SunSunSat14:002898
08/01/2017 15:0015:0025191SunSunSat15:002923
08/01/2017 16:0016:0025192SunSunSat16:002948
08/01/2017 17:0017:0025193SunSunSat17:002973
08/01/2017 18:0018:0025194SunSunSat18:002998
08/01/2017 19:0019:0025195SunSunSat19:003023
08/01/2017 20:0020:0025196SunSunSat20:003048
08/01/2017 21:0021:0025197SunSunSat21:003073
08/01/2017 22:0022:0025198SunSunSat22:003098
08/01/2017 23:0023:0025199SunSunSat23:003123
08/01/2017 23:5900:0025200SunSunSat00:003148

<colgroup><col><col span="2"><col><col><col><col><col><col><col><col><col><col><col span="3"></colgroup><tbody>
</tbody>
 
Upvote 0
Thanks for your help on this, however, the monetary values of the respective rates is not particularly important, it is the calculation (or summing) of the hours by shift category that is. Any chance you could make the content of your reply a little clearer ? You mentioned the helper table, however I'm not certain what the numbers are in the far right hand side ? Thanks.
 
Upvote 0
in stead of a dollar rate I could have put in an hours "figure" ie 1,1.3,1.5,2.0

then you would multiply base salary by hours.

The last but one column eg sun00:00 is just a concatenation of the day of the week with the time of the day, the last bit is eg satsun00:00 is to allow for a saturday start and sunday finish.

The last column is a running total of pay, so you deduct start day time pay from end day time pay.
 
Upvote 0

Forum statistics

Threads
1,215,389
Messages
6,124,665
Members
449,178
Latest member
Emilou

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top