How to Split Shifts into Day/Night, Weekends

WaheedIqbal

New Member
Joined
Jun 5, 2018
Messages
5
Dear Excel experts,

I am required to make payroll payment to few (10-15) employees working in Security industry (Shift workers). The pays are determined by the timings of the shift i.e different rates of pay for Day shift (06:00 to 18:00), night shift (06:00 to 18:00), Saturday (24 hrs) and Sunday (24 hrs).

Please see sample data from the manual working i have done:
DateShiftStart TimeFinish TimeHoursDayNightSatSun
14-03-18Wednesday20:000:00 4.00 4
16-03-18

<tbody>
</tbody>
Friday

<tbody>
</tbody>
22:00

<tbody>
</tbody>
2:15

<tbody>
</tbody>
4.25

<tbody>
</tbody>
2

<tbody>
</tbody>
2.25

<tbody>
</tbody>
17-03-18

<tbody>
</tbody>
Saturday

<tbody>
</tbody>
15:00

<tbody>
</tbody>
4:30

<tbody>
</tbody>
13.50

<tbody>
</tbody>
9

<tbody>
</tbody>
4.5

<tbody>
</tbody>

<colgroup><col><col><col><col><col><col span="4"></colgroup><tbody>
</tbody>

The first four columns is what i get from my operations team and i then manually split the shifts into Day/Night/Sat/Sun.

Is there a way that this can be automated?

Many thanks for your help.

Regards,

Waheed
 
Change O2 to =N2+1 and re-check the result of my formula.
@jorismoerings,

This was!!!
You have not specified in the posts before, and in N2 and O2 it is clear 00:00:00

P.S.
I tested your formulas in excel 2010, 2013, 2016 and excel in office 365 and in all versions I gave 0 (zero).
After changing the O2 cell in = N2 + 1 it's OK now.
 
Upvote 0

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
There you go. Got it. =o2=n2 was true and changing it as you mentioned above has solved the issue.

Bundle of thanks for your time Joris. You the champ.

Best Regards,
Waheed
 
Upvote 0
Hello,
I am trying to use the above spreadsheet to calculate hours at night, weekends etc
When I ;paste the formula F2 I get an error saying there is something wrong with the formula. This is Office 365 and i have enabled the analysis pack add in.
Any idea why i might be getting an error ?
Many thanks.
 
Upvote 0
Hello,
I am trying to use the above spreadsheet to calculate hours at night, weekends etc
When I ;paste the formula F2 I get an error saying there is something wrong with the formula. This is Office 365 and i have enabled the analysis pack add in.
Any idea why i might be getting an error ?
Many thanks.
hi Kiera

could you show more details of the error? Does it come with a not expected answer, does it show #n/a, or error or …
 
Upvote 0
Hello amd thanks for the reply.
I have pasted a minisheet below. Also a picture of the error.
I have also posted an example minisheet of what i am trying to achieve (will send in next post).
Hope you can help!
Many thanks
Kier.


Hours calcs.xlsx
ABCDEFGHIJKLMNOP
1DATESHIFTSTART TIMEFINISHI TIMEHOURSDAYNIGHTSATSUNDAY SHIFT06:00:0018:00:00
211/05/2018FRIDAY22:00:0002:00:0000:00=IFERROR(((NETWORKDAYS.INTL((C2+E2),(C2+(F2)+F2),"0000011",)-1)*($O$1-$N$1)+IF(NETWORKDAYS.INTL((IF(F2)+F2),(IF(F2)+F2),"0000011"),MEDIAN(MOD((IF(F2)+F2),1),$O$1,$N$1),$O$1)-MEDIAN(NETWORKDAYS.INTL((C2+E2),(C2+E2),"0000011")*MOD((C2+E2),1),$O$1,$N$1))*24,0)#VALUE!=IFERROR(((NETWORKDAYS.INTL((C2+E2),(IF(F2)+F2),"1111101")-1)*($O$2-$N$2)+IF(NETWORKDAYS.INTL((IF(F2)+F2),(IF(F2)+F2),"1111101"),MEDIAN(MOD((IF(F2)+F2),1),$O$2,$N$2),$O$2)-MEDIAN(NETWORKDAYS.INTL((C2+E2),(C2+E2),"1111101")*MOD((C2+E2),1),$O$2,$N$2))*24,0)=IFERROR(((NETWORKDAYS.INTL((C2+E2),(IF(F2)+F2),"1111110")-1)*($O$2-$N$2)+IF(NETWORKDAYS.INTL((IF(F2)+F2),(IF(F2)+F2),"1111110"),MEDIAN(MOD((IF(F2)+F2),1),$O$2,$N$2),$O$2)-MEDIAN(NETWORKDAYS.INTL((C2+E2),(C2+E2),"1111110")*MOD((C2+E2),1),$O$2,$N$2))*24,0)SAT /SUN00:00:0000:00:00
312/05/2018SATURDAY23:0003:0000:00=IFERROR(((NETWORKDAYS.INTL((C2+E2),(C2+(F2)+F2),"0000011",)-1)*($O$1-$N$1)+IF(NETWORKDAYS.INTL((IF(F2)+F2),(IF(F2)+F2),"0000011"),MEDIAN(MOD((IF(F2)+F2),1),$O$1,$N$1),$O$1)-MEDIAN(NETWORKDAYS.INTL((C2+E2),(C2+E2),"0000011")*MOD((C2+E2),1),$O$1,$N$1))*24,0)0
411/05/2018FRIDAY22:0002:0000:00=IFERROR(((NETWORKDAYS.INTL((C2+E2),(C2+(F2)+F2),"0000011",)-1)*($O$1-$N$1)+IF(NETWORKDAYS.INTL((IF(F2)+F2),(IF(F2)+F2),"0000011"),MEDIAN(MOD((IF(F2)+F2),1),$O$1,$N$1),$O$1)-MEDIAN(NETWORKDAYS.INTL((C2+E2),(C2+E2),"0000011")*MOD((C2+E2),1),$O$1,$N$1))*24,0)#VALUE!
5
6
Sheet1
Cell Formulas
RangeFormula
O2O2=N2+1
G2:G4G2=SUM(F2:I2)
I2:I4I2=IF(WEEKDAY(C2,2)<6,(((C2+IF(AND(WEEKDAY(C2,2)=5,F2),$O$2,F2))-(C2+E2)+((C2+IF(AND(WEEKDAY(C2,2)=5,F2),$O$2,F2))<(C2+E2)))*24)-H2,0)
 

Attachments

  • Excel pic.png
    Excel pic.png
    26.9 KB · Views: 6
Upvote 0
Export - 2022-05-02T140127.666.xls
ABCDEFGHIJK
1Timesheets Previously ReleasedHours day (Week day)Hours Night (excluding weekends)Hours SaturdayHours SundayHours Bank Holiday
2DateActual0600-20002000-06000000-00000000-00000000-0000
3StartEndBreak In MinutesTotal
411/04/202219:4507:454511:15
5
611/04/202206:4520:456013:00
7
811/04/202221:0008:004510:15
9
1011/04/202208:0020:003011:30
11
1211/04/202220:0008:004511:15
13
1411/04/202208:3016:303007:30
15
1611/04/202209:0017:003007:30
17
1811/04/202208:0020:003011:30
19
2011/04/202209:0017:003007:30
21
2211/04/202209:0017:003007:30
23
2411/04/202209:0017:003007:30
25
Export - 2022-05-02T140127.666
 
Upvote 0
hi Kiera

could you show more details of the error? Does it come with a not expected answer, does it show #n/a, or error or …
Hey... dont suppose you have any thoughts on the info I sent yesterday?
BW
Kier.
 
Upvote 0
Nope sorry, it’s been busy at work. Will try to look at it tomorrow.
 
Upvote 0

Forum statistics

Threads
1,216,225
Messages
6,129,599
Members
449,520
Latest member
TBFrieds

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