Excel - Automatic allocation of preferences - excel

Edit: Example file available here.
I'm not a super experienced Excel user, but I'm trying to automate using IF/AND/INDEX/MATCH to assign yes/no to preferences which competitively listed people have chosen from a list of about 300 choices. Each person has listed 4 preferences, there's over 1000 people in the process, and each person gets one preference out of four. A simplified hypothetical version of it is a situation where I want automate the allocation of employee shifts at a restaurant, with the employee data listed with the best workers at the top and the worst ones at the bottom.
Traditionally the Shift Allocation sheet has been done manually, which is fine when you have seven days of the week and maybe 30 employees. But if I have 300 days of the week and 1000 employees, I don't want to manually allocate each one to their preferences. Or if I do have a manual input, I want it to automate enough shift allocation beforehand so it doesn't take up as much time.
Ideally the automated formula to assign the yes/no indicator for the shift in the Shift Allocation would look at the first preference (day of the week) the person has listed in the Employee Data sheet, check the Shifts Available sheet to find the day of the week and then look at the number of shifts available in column K, if column K is more than 0, assign YES to that employee's preference on the Shift Allocation sheet, then move on to the next employee.
The employees are listed by who gets first pick, so in theory some people at the bottom may not get the shifts they preferenced, or there may need to be other manual changes made after the automatic allocation process for other reasons.
I tried VLOOKUP but the lookup logic wasn't broad enough, so I need something like an INDEX/MATCH parameter to find the shift places available in column K of the Shifts Available sheet after finding the day of the week in Column A.
This is about as far as I got with the code
=IF(AND(INDEX('Shifts Available'!$A$2:$K$8, MATCH('Employee Data'!$A$2,0)), 'Shifts Available'![K-column cell corresponding to the day of the week, unsure how to do this? Keep it in the INDEX?]) >=0)"Yes", "No")
Any help is appreciated.

Related

Change values in cells based on data from drop down list

I'm making a basic booking system for our equipment, it's meant to be accessed in a teams folder, where you can either mark X for whole day, or hours the equipment will be used.
How can I connect the weekly schedule with the drop down list? Since I'm not using preset value, but inputs from every time something gets booked.
When I or a coworker change "Vecka:" (Week:) I want the "X" and time stamps to change accordingly. People must be able to book stuff weeks in advance. Preferably I'd also want the date next to the days to be applied aswell.
Maybe so. Mon-Sun even with date, for many weeks. Scrolling to the right. Freezing column A. Enter Weeknumber (combined with year) in A7, press Enter and it will scroll to that week.

How do I set a value limit to a specific cell in Excel and add exceding entries to another cell?

Over the past couple of days, I've had a hard time figuring out an issue that is supposed to be easy but I just can't wrap my head around.
To add some context, here's what I'm trying to do: I'm working on a class attendance sheet for teachers to keep track of students' attendance. In order to submit an entry, teachers will have to fill in 4 different cells: Date, Time, Lesson Content and Status (whether the class took place or the student didn't show up). I've added a dropdown to the Status cell so that the teacher chooses between predetermined codes (more on that soon).
I've also included a separate sheet where the school will register eventual replacement classes set up in alternative schedules, and it works in a similar fashion to the overall attendance sheet.
The third and last sheet in this workbook (where I'm having some issues) is an Hour Bank that is calculated based on the amount of cancellations versus the replacement classes the student scheduled and attended.
Here's where the issue kicks in. As I mentioned, I would like to create an Hour Bank System in order to store the classes that are "replaceable". This would be a relatively simple task, the only issue is that I also need to establish a cap (which is 8) so that the Hour Bank will not add beyond this specific number. The Hour Bank works fine, but the number doesn't go down immediately if the student exceeds the cap. If the student has, for instance, 2 classes over the cap, the Hour Bank Balance only goes down to 7 if I enter two replacement classes. However, I would like this particular cell to cap at 8 and go down as soon as a replacement class is registered, regardless of how many hours the student exceeds this cap.
Here are the elements contained in the 3rd sheet:
-Total Classes Given (D8): This part works fine. It's just a SUMIF with the specific code that means "Class ok". Code below:
=SUMIF(FREQ!F9:F106;"AR";FREQ!G9:G106)
-Total Client Cancellations (D11): This part also works fine. It's another SUMIF with the specific code meaning that the student didn't show up to class and didn't notify the school. These classes won't be accounted for in the hour bank. Code below:
=SUMIF(FREQ!F9:F106;"AC (Aluno)";FREQ!G9:G106)
-Total Replaceable Classes (D14): This part works fine. It's a combination of two SUMIFs with the codes that mean "Ok, student didn't come but we'll let them schedule a replacement class". Code below:
=SUMIF(FREQ!F9:F106;"PP";FREQ!G12:G109) + SUMIF(FREQ!F9:F106;"AC (Miles)";FREQ!G12:G109)
-Attendance Rate (D17): This part also works fine. It just shows the percentage of the classes that the student has attended up until the present moment. Code below:
=IF(D8>0; D8/FREQ!G107; "0,00%")
-Pending Replacement Classes (G8): This part works fine. It is a simple subtraction that calculates how many classes are pending (not considering the cap). This number goes down as I enter replacement classes in the second sheet of the workbook, and goes up as the teacher registers replaceable cancellations in the first sheet. Code below:
=D14-G11
-Given Replacement Classes (G11): This part works fine. It is a SUMIF that keeps track of how many replacement classes were given in total. Code:
=SUMIF(REPO!F9:F106;"AR";REPO!G9:G106)
-Exceding Hours (G14): This cell is broken. I'd like it to compute the amount of hours that the student has cancelled over the established cap. It does work when it comes to only computing the hours over the cap, but the issue is that it decreases as I enter replacement classes in the 2nd sheet of the workbook instead of subtracting them from the Hour Bank Balance which I will explain below.
=IF(G17=8; G8-8; 0)
-Hour Bank Balance (G17): This cell is broken, and it's the most important part of the entire workbook. I would like it to compute the replaceable classes up until the cap (which is 8) and make it go down immediately as a replacement class is registered. However, if the student has Exceding Hours (G14), the replacement classes are substracted from G14 instead of G17, which is what I wanted. The Hour Bank Balance (G17) will only go down if the Exceding Hours (G14) equals zero. Here's the code:
=IF((D14-G11)>8; 8; D14-G11)
I hope I was clear enough and I'm willing to provide screenshots if need be. I'm sure there's a problem with my maths or something, but I've been unable to spot it.
Please help a brother out!
Thanks in advance
I think that this formula might be what you’re looking for:
=IF((D14 - G11) > 8, 8, IF(D14 > 8, 8, D14) - G11)
The first part of this formula would give 8 as a value if D14 - G11 is greater than 8; the second part of this formula yields D14 - G11 except for in cases where D14 is greater than 8, then it gives 8 - G11. Hopefully this is what you were looking for.

How to do conditional formatting against a range of times

I have a lunch rota which has the names and the times people are going on lunch. I'm trying to make it possible to add a more visual approach to when people lunches are. So that we can see who the number of people available between times.
The idea was to have a list of times in 30-minute increments from 9:00 to 17:00 and with the use of conditional formatting the colour would change gradually depending on the availability.
The complexity comes from certain people either having either 30 or 1-hour breaks. Any idea of how this could be done will be a great help this is to limit people having lunches at the same time and causing issues.
Thanks in advance.
Edit - I've added a link with a screenshot of the concept I'll like to achieve. I have 25 users total across 3 groups and if there's less then 2 available per half hour slot. I'll like the colour to change to orange and then if 1 or less change to red. (Not all 25 users are always in).
I have assumed you want to count the number of users on their lunch break in each time slot. If you need something more you can use my answer as a starting point, e.g. If you want the number of users excluding those on lunch break.
1: Add a new column 'End', D2 =B2+C2, and paste this for each user
2: Add formula in Covered column:
=COUNTIFS(B$2:B$31,"<=" & F2,D$2:D$31,">" & F2)
This formula counts the number of users who are at lunch in that time slot.
Copy this down column G to end at 17:00. The F2 will change to F3 so it is the right time slot, while the users' start and end time ranges will stay constant, because of the $.
3: Apply conditional formatting as needed to column G.

Index Match Match across multiple columns

I have an Index Match Match question that I have not been able to find the answer for in researching. Although the solution may actually might be different than an Index Match Match formula - I'm open to try something more efficient than my current workaround.
I have one worksheet with data from my company on it. We sell a Product (let's call it Coke Zero) and we track the weeks that we put a promotion on and how much profit we make by selling it to the retailer. For example a promotion for Coke Zero starts the first week of Jan and ends 3 weeks later and we make a gross profit of $100 each week the promotion runs. I then have an external database with sales data formatted on a weekly basis to tell me how many units of Coke Zero I sold in each week. My internal data has thousands of lines like this with dozens of products, however the promotions are consolidated on one single row regardless of if it runs for more than one week, making matching up to the external database difficult. I need to create a lookup for what our Gross Profit was for each week of the promotion.
I have attached an example image of the workbook + two data sheets of what I've tried to do, summarised below.
On the Internal Data Sheet I've created additional columns to the right with all of the weeks listed that the promotion is on for, and concatenated them with the Product Code to be able to match week by week to the data in the External data sheet. Then my lookup basically checks every column one after another until it finds one where the concatenate of Week_Product Code concatenate matches.
My current solution technically works but my final formula is really slow and cumbersome given the data can be anywhere from 10K-200K lines when looking at multiple retailers. I was hoping to find a more efficient formula to complete the lookup.
Current solution on the External Data Sheet Column E:
=IF(ISNUMBER(MATCH(D2,'Internal Data'!$E:$E,0)),INDEX('Internal Data'!$D:$D,MATCH(D2,'Internal Data'!$E:$E,0)),
IF(ISNUMBER(MATCH(D2,'Internal Data'!$F:$F,0)),INDEX('Internal Data'!$D:$D,MATCH(D2,'Internal Data'!$F:$F,0)),
IF(ISNUMBER(MATCH(D2,'Internal Data'!$G:$G,0)),INDEX('Internal Data'!$D:$D,MATCH(D2,'Internal Data'!$G:$G,0)),
"0")))
I got SUMPRODUCT to work using this formula in J2:
=SUMPRODUCT(--($B$2:$D$3=H2)*--($E$2:$E$3=I2)*$F$2:$F$3)
And, you don't need those concatenated lookup columns:
Well, that was fun.

Trying to calculate tasks in Excel

I was going to ask my question over at that "Experts" place, but they wanted me to pay $12.95! Fo that price I could pay some college wiz kid to do this for me, and have it done quicker!
Ok, this should be an easy one, but for some reason my brain is freezing up when I try to do it.
I have a spreadsheet with three sheets in it. The first has the tasks completed in it:
Created Time CreatedUserName ServiceDetailName BillingCnt
7/1/2010 6:25:17 AM Employee Name Tape Management 30
7/1/2010 8:15:33 AM Employee Name Information Request Detailed 1
7/1/2010 8:18:24 AM Employee Name Hard drive 1
7/1/2010 8:25:42 AM Employee Name Information Request Brief 2
7/1/2010 10:33:17 AM Employee Name Scratch Tape Count 2
7/1/2010 2:07:59 PM Employee Name Hard drive 1
7/1/2010 2:18:36 PM Employee Name I/O module 1
The next 2 pages have information regarding the value of each task as well as internal descriptions:
Task Type Task Detail Task Description Unit of Measure (in Minutes)
INC Hard Drive Swap Drive 60
MAC Tapes Managment Change Tapes 1
There are about 30 tasks per page. I want to somehow take the billing count from page one and multiply it by the unit of measure. Then I have a cell set up where I want the total displayed in total minutes then another cell where it is in hours and minutes.
I have a sample spreadsheet but I can't see any place to attach it.
hmm ... not really a very normalized design ... I would expect that at least one column in sheet 1 should match one column in sheet 2
Either introduce Task Type in sheet 1 or match [Sheet1].ServiceDetailName with [Sheet2].TaskDetail - that's the closest match I could find, though in [1] you write "Tape Management" whereas in [2] you write "Tapes Management". As long as the input data stays that way the best is to give it to an assistant ;-)
so here's my suggestion:
one master table of task types (like your [2])
create a named range across [2].TaskDetails (except header) and use this range as cell validation in [1].ServiceDetailName. Don't allow manual input
create another named range across [2].TaskDetails expanded to include column "UOM"
in [1] use a =VLOOKUP() function to match the UOM into the detail table
in a further column multiply BillingCnt times UOM to get minutes
to display minutes in hh:mm in the next column you divide minutes by 1440 (60*24) to get "fraction of day" and format it with custom string "[h]:mm"
Hope that helps
Good luck - MikeD
-

Resources