# Shifts and bonuses

#### astaha

##### New Member
Hi,
I have a problem I have been trying to find a solution to for a while now. We have people that work shifts. Bonuses can be received for each shift depending on time and day.
---**disclaimer** this is not the actual bonus system, since we don't even use dollars in my country but it's just to get the point across.---
For each hour worked between 12am and 7:59am you get \$2.
For each hour worked between 08am and 3:59pm there is no bonus, so \$0,
for each hour worked between 4pm to 11:59pm there is a bonus of \$1.
On top of this the system is a little different depending on the day of the week, ie you get higher bonus on weekends (sat-sun) but let's keep that out of it for now.
So, if the shift is, from 11pm to 8am the worker should get \$1 for 11pm to 12am, \$2 for every hour worked between 12am to 7am (so 7*2) and no bonus for the last hour from 7am to 8am. In total \$15.
Then we have various shifts, and over 700 employees so calculating each shift per person by hand is absolute madness. How do I get excel to calculate the bonus for each person, each shift and return a value. I would like to be able to use the shift schedule made by the shift manager to see how much bonus each worker on the schedule should get. Shift schedule includes dates and start and end time of each shift per person.
I hope the problem is clear, if not, please ask for clarification or more details Thanks in advance!

### Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.

#### ChrisFoster

##### Board Regular
I understand what you need. One question though, how do you record what hours an employee has worked?

#### astaha

##### New Member
I understand what you need. One question though, how do you record what hours an employee has worked?
Hey thanks for the question! we have a clock-in/out system which also holds the actual shifts and I can export an excel sheet from there with both shifts and timestamps if needed

#### ChrisFoster

##### Board Regular
Hey thanks for the question! we have a clock-in/out system which also holds the actual shifts and I can export an excel sheet from there with both shifts and timestamps if needed
If you could provide some sample data so I can see what it looks like then I'll see what I can do to help.

#### astaha

##### New Member

I could send you the document I'm using, but the actual problem is alot bigger and more complicated then in the sample case I made, but the solution should be about the same?

#### astaha

##### New Member
Or just something like this. This is a very simplified version

 shift start shift end date bonus total John 08:00​ 17:00​ 7.8.2020​ Jane 23:00​ 08:00​ 7.8.2020​ Dave 17:00​ 23:00​ 7.8.2020​ Hours bonus mon-fri bonus sat-sun 00-07 2​ 2​ 08-16 0​ 1​ 17-00 1​ 1​

#### Sulprobil

##### Board Regular
Please have a look at this sample file (download, open, and use at your own risk - but I am using an up-to-date virus scanner):

This is how it looks like:
MrExcel_Shifts_and_Bonuses_sbTimeDiff.xlsm
ABCDEFGHIJKLMNOPQRSTUVW
1Bonus WeekdaysBonus WeekendsBonus Bank Holidays
2Time WeekdaysTime WeekendsTime Bank HolidaysNightEarlyLateNightEarlyLateNightEarlyLate
3NameDayShift StartShift EndNightEarlyLateNightEarlyLateNightEarlyLate\$2,00\$0,00\$1,00\$2,00\$0,00\$1,00\$4,00\$2,00\$3,00Bonus Total
4JohnSo 30-Aug-20208:0017:000:000:000:000:008:001:000:000:000:00\$0,00\$0,00\$0,00\$0,00\$0,00\$1,00\$0,00\$0,00\$0,00\$1,00
5JaneSo 30-Aug-202023:008:000:000:000:000:000:001:008:000:000:00\$0,00\$0,00\$0,00\$0,00\$0,00\$1,00\$32,00\$0,00\$0,00\$33,00
6DaveSo 30-Aug-202017:0023:000:000:000:000:000:006:000:000:000:00\$0,00\$0,00\$0,00\$0,00\$0,00\$6,00\$0,00\$0,00\$0,00\$6,00
7RobotSo 30-Aug-20200:0024:000:000:000:008:008:008:000:000:000:00\$0,00\$0,00\$0,00\$16,00\$0,00\$8,00\$0,00\$0,00\$0,00\$24,00
8JohnMo 31-Aug-20208:0017:000:000:000:000:000:000:000:008:001:00\$0,00\$0,00\$0,00\$0,00\$0,00\$0,00\$0,00\$16,00\$3,00\$19,00
9JaneMo 31-Aug-202023:008:008:000:000:000:000:000:000:000:001:00\$16,00\$0,00\$0,00\$0,00\$0,00\$0,00\$0,00\$0,00\$3,00\$19,00
10DaveMo 31-Aug-202017:0023:000:000:000:000:000:000:000:000:006:00\$0,00\$0,00\$0,00\$0,00\$0,00\$0,00\$0,00\$0,00\$18,00\$18,00
11RobotMo 31-Aug-20200:0024:000:000:000:000:000:000:008:008:008:00\$0,00\$0,00\$0,00\$0,00\$0,00\$0,00\$32,00\$16,00\$24,00\$72,00
12JohnDi 01-Sep-20208:0017:000:008:001:000:000:000:000:000:000:00\$0,00\$0,00\$1,00\$0,00\$0,00\$0,00\$0,00\$0,00\$0,00\$1,00
13JaneDi 01-Sep-202023:008:008:000:001:000:000:000:000:000:000:00\$16,00\$0,00\$1,00\$0,00\$0,00\$0,00\$0,00\$0,00\$0,00\$17,00
14DaveDi 01-Sep-202017:0023:000:000:006:000:000:000:000:000:000:00\$0,00\$0,00\$6,00\$0,00\$0,00\$0,00\$0,00\$0,00\$0,00\$6,00
15RobotDi 01-Sep-20200:0024:008:008:008:000:000:000:000:000:000:00\$16,00\$0,00\$8,00\$0,00\$0,00\$0,00\$0,00\$0,00\$0,00\$24,00
Shifts_n_Bonuses
Cell Formulas
RangeFormula
E4:E15E4=sbTimeDiff(\$B4+\$C4,\$B4+\$D4+(\$D4<\$C4),WD_Night,Holidays)
F4:F15F4=sbTimeDiff(\$B4+\$C4,\$B4+\$D4+(\$D4<\$C4),WD_Early,Holidays)
G4:G15G4=sbTimeDiff(\$B4+\$C4,\$B4+\$D4+(\$D4<\$C4),WD_Late,Holidays)
H4:H15H4=sbTimeDiff(\$B4+\$C4,\$B4+\$D4+(\$D4<\$C4),WE_Night,Holidays)
I4:I15I4=sbTimeDiff(\$B4+\$C4,\$B4+\$D4+(\$D4<\$C4),WE_Early,Holidays)
J4:J15J4=sbTimeDiff(\$B4+\$C4,\$B4+\$D4+(\$D4<\$C4),WE_Late,Holidays)
K4:K15K4=sbTimeDiff(\$B4+\$C4,\$B4+\$D4+(\$D4<\$C4),BH_Night,Holidays)
L4:L15L4=sbTimeDiff(\$B4+\$C4,\$B4+\$D4+(\$D4<\$C4),BH_Early,Holidays)
M4:M15M4=sbTimeDiff(\$B4+\$C4,\$B4+\$D4+(\$D4<\$C4),BH_Late,Holidays)
N4:V15N4=N\$3*E4*24
W4:W15W4=SUM(N4:V4)

An extract of sheet TimeTables (named ranges are used - you will guess where they are):
MrExcel_Shifts_and_Bonuses_sbTimeDiff.xlsm
ABCDEFGHIJKLM
1WeekdaysWeekendsBank HolidaysUK Holidays
2Fr 19-Apr-2019
3Night ShiftStartEndNight ShiftStartEndNight ShiftStartEndMo 22-Apr-2019
4Monday0:008:00MondayMondayMo 06-Mai-2019
5Tuesday0:008:00TuesdayTuesdayMo 27-Mai-2019
6Wednesday0:008:00WednesdayWednesdayMo 26-Aug-2019
7Thursday0:008:00ThursdayThursdayMi 25-Dez-2019
8Friday0:008:00FridayFridayDo 26-Dez-2019
9SaturdaySaturday0:008:00SaturdayMi 01-Jan-2020
10SundaySunday0:008:00SundayFr 10-Apr-2020
11HolidaysHolidaysHolidays0:008:00Mo 13-Apr-2020
12Mo 04-Mai-2020
13Early ShiftStartEndEarly ShiftStartEndEarly ShiftStartEndMo 25-Mai-2020
14Monday8:0016:00MondayMondayMo 31-Aug-2020
15Tuesday8:0016:00TuesdayTuesdayFr 25-Dez-2020
16Wednesday8:0016:00WednesdayWednesdayMo 28-Dez-2020
17Thursday8:0016:00ThursdayThursdayFr 01-Jan-2021
18Friday8:0016:00FridayFridayFr 02-Apr-2021
19SaturdaySaturday8:0016:00SaturdayMo 05-Apr-2021
20SundaySunday8:0016:00SundayMo 03-Mai-2021
21HolidaysHolidaysHolidays8:0016:00Mo 31-Mai-2021
22Mo 30-Aug-2021
23Late ShiftStartEndLate ShiftStartEndLate ShiftStartEndMo 27-Dez-2021
24Monday16:0024:00MondayMondayDi 28-Dez-2021
25Tuesday16:0024:00TuesdayTuesdayMo 03-Jan-2022
26Wednesday16:0024:00WednesdayWednesdayFr 15-Apr-2022
27Thursday16:0024:00ThursdayThursdayMo 18-Apr-2022
28Friday16:0024:00FridayFridayMo 02-Mai-2022
29SaturdaySaturday16:0024:00SaturdayMo 30-Mai-2022
30SundaySunday16:0024:00SundayMo 29-Aug-2022
31HolidaysHolidaysHolidays16:0024:00Mo 26-Dez-2022
TimeTables

#### astaha

##### New Member
Thanks! I will definitely have a look, you even thought of the bank holidays

Replies
3
Views
147
Replies
0
Views
226
Replies
6
Views
407
Replies
1
Views
83
Replies
3
Views
65

1,127,573
Messages
5,625,594
Members
416,121
Latest member
MrBuzz

### 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.

### Which adblocker are you using?

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

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