Calculating shift allowance

mwvirk

Active Member
Joined
Mar 2, 2011
Messages
293
Office Version
  1. 2016
Platform
  1. Windows
Hi
I would really appreciate if someone could help me to calculate my shift allowance based on the attached screenshot.
Kindly note that:
working days are Sunday to Thursday
Friday & Saturday are weekend

I think to calculate the holiday rate, we can add one extra cell having P (meaning if value in the cell is P and it's still working day i.e. Sun to Thu then calculate weekend rate)
Thank you.
 

Attachments

  • 1002263024.jpg
    1002263024.jpg
    128.9 KB · Views: 23
Can you show how a correctly filled row from D to V should look like? The different cases. With 4 persons, 3, and so forth. Also 1 or more person is on vacation. How many employees do you have in total that cover the shifts?
 
Upvote 0

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
Can you show how a correctly filled row from D to V should look like? The different cases. With 4 persons, 3, and so forth. Also 1 or more person is on vacation. How many employees do you have in total that cover the shifts?

currently, we have 8 employees
keeping slot for 3 as "Vacant" in case we hire 1 2 or 3 more
there is no fix limit to how many employees will be in each shift but I am keeping space for 4 people in each shift.
i not sure how it is possible to create a check that if there is any name in D to V then it shouldn't be selected in any other cell in that particular row



Calculate Shift Allowance.xlsx
ABCDEFGHIJKLMNOPQRSTUVWXYZAAABACADAEAFAGAH
1TypeDateDay of The WeekMorning Shift 08:00 Hrs To 16:00 HrsAfternoon Shift 16:00 Hrs To 24:00 HrsNight Shift 00:00 Hrs To 08:00 HrsOff ShiftVacationMikeGerogePeterAlex CSamRogerAlex NAdamVacantVacantVacant
2W01-Aug-2024ThuMikeGerogePeterAlex CSamRogerAlex NAdamthe daily shift allowance should be here based on the schedule
3WSatGerogePeterAlex CSamRogerAlex NAdamMike
4WMikeGerogePeterAlex CSamRogerAlex NAdam
5
6
7
8
9
Sheet1
Cell Formulas
RangeFormula
C2C2=TEXT(B2,"ddd")
C3C3=IF(B3="",TEXT(B3,"ddd"))
Cells with Data Validation
CellAllowCriteria
A2:A9List=$AK$1:$AL$1
D2:V9List=$X$1:$AH$1
 
Upvote 0
Ok here is (what i believe) the solution to the first requirement:
We will need to use some helper columns.
In AJ3 we use this formula and draw down:

Excel Formula:
=LET(availableEmployees, TOROW($X$1:$AH$1, 1,1),
usedEmployees, IFERROR(TOROW(D2:V2,1,1), ""),
r, HSTACK(availableEmployees, usedEmployees),
IFERROR(UNIQUE(r, TRUE,TRUE), "")
)

This will give us the available employees to use in our data validation.

Then with any cell in row 2 selected we create this named range (adjusting the name of the sheet):
Name: "AvilableEmployees"
Excel Formula:
=Sheet1!$AJ2:$AT2

With cell D2 selected we create the data validation like this:
1725386596736.png


Now we copy cell D2 to all the cells where we want to select an employee, from our example D2:V4.

Now you data validation list will be updates as you select the employees for ever shift

1725386794305.png
ç

You can hide the columns AJ:AT or use another sheet for them and hide the whole sheet.

Here the working file for you to download: ShiftAllowance.zip

Let me know if this works for you and then the next requirement...
 
Upvote 1
i am trying to use your file and then after adding any name as test, i am getting these errors.
is it becasue of different versions of Excel?
i am using Office 2016

1725390756818.png




1725390781563.png
 
Upvote 0
Here is the version for 2016:

ShiftAllowance2.zip

Only thing that changes it the formula in column AJ.

Excel Formula:
=IFERROR(TRANSPOSE(FILTERXML("<a>"&CONCAT(IF(NOT(COUNTIF(D2:V2, $X$1:$AH$1))*($X$1:$AH$1<>""), "<b>"&$X$1:$AH$1&"</b>", ""))&"</a>","//b")), "")

Let me know if it works ok for you.
 
Upvote 1
Here is the version for 2016:

ShiftAllowance2.zip

Only thing that changes it the formula in column AJ.

Excel Formula:
=IFERROR(TRANSPOSE(FILTERXML("<a>"&CONCAT(IF(NOT(COUNTIF(D2:V2, $X$1:$AH$1))*($X$1:$AH$1<>""), "<b>"&$X$1:$AH$1&"</b>", ""))&"</a>","//b")), "")

Let me know if it works ok for you.
i really appreciate your efforts and giving your valuable time.
there are still some issues. i am using your file and after making any change in a row by adding 1 staff, I cannot select any other in drop down. i will share the screenshots before and after:

this is how your file is after opening:
1725459854173.png



1725459878465.png


then after inserting 1 staff:
drop down is empty
and
in AJ2 to AQ2, staff names are disappreared. so there is nothing select in drop down


1725459945951.png


1725459989855.png
 
Upvote 0
My mistake again. Didn't remember that CONCAT isn't available in 2016.
I needed to add some more helper columns:

ShiftAllowance3.zip

Hopefully now it works for you. Let me know.
 
Upvote 0
I don't have those issues:

1725535349305.png


It is a little difficult to debug it without having the correct excel version. But I will try.

Can you show me what you see when you select cell AJ2 and then hit F2 and then F9 (having the row filled as you showed in your last post).
What I see:

1725535487619.png


After that hit ESC to go back to the formula (or if you did hit enter, just go back one step).

Do the same for AU2. What I see:

1725535564508.png
 
Upvote 0

Forum statistics

Threads
1,223,885
Messages
6,175,181
Members
452,615
Latest member
bogeys2birdies

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