Excel: Allocating Streams to Students based on GPA and Choice Preference - excel

I have a total of 64 students to be allocated to 19 different streams on the basis of their GPA. Students have also indicated their preference for the streams. Only 5 students can be allocated to first three streams (A-C), 4 students to Stream D and the remaining fifteen streams get 3 students each. I have added the data to an excel sheet but have no idea how to process that to achieve the above results. The data is organized like this. I'm happy to share the original file but couldn't find way to upload that.

This could be solved automatically in a vba macro but the slightly faster version is doing it a bit fast and dirty with formulas. It starts like you have already, ranking by gpa.
Insert 2 rows for each student. In this row you will calculate the "filling" of the streams. If you have a bazillion students, you should write a small macro to copy paste so you get every other line. A shame that excel does not accept pasting empty values as no-change-values.
Either change the rankings by search/replace or create a new sheet where the "desired allocation" value is HIGHEST for the MOST WANTED stream.
Cell C2 should be like this:
=20-'originalsheet'!C2
We are now working on the new sheet
So you have these rows: (student - allocation - availability - student - allocation - availability)
In the allocation line, you will fill the allocation of the student above, in the availability row you will fill the current available spaces.
The first student gets allocated to his or hers choice.
The allocation row gets a formula that investigates if the current cell has the lowest possible value. So. Row2: first student, Row3: Allocation, Row4: new availability, Row5: Students wishes, Row 6: We use this formula in cell C6
=if(sumproduct(max(($C5:$U5)*(($C4:$U4)>0)))=C6;1;0)
Then the next line, new availability is simply
=C4-C6
copy paste the formulas downwards. You may get trouble with students on exactly similar GPAs but your ranking from top to bottom is what sets the priority in this scheme. I don't have the original file and I don't have time to build it from an image but it looked like it worked for my tiny test-setup.
Slightly easier than doing it by hand, but again; if you have a bazillion students and are doing this allocation often - ask in the vba section.
Summary:
Rank by GPA
Change so highest wish is highest number
Insert 2 rows for each student
Calculate manually for first student, should not be difficult...
Use formulas and make certain the cell references are not bungled up.

Related

How to count pairs of cells in alternate rows

I am preparing a weekly time-table for my school which looks like the following
The even rows contains course names, whereas the odd rows contain the teacher initials. Observe that a same paper is taken by more than one teacher (e.g., C10 C11 and G10 G11). I need to count the total number of classes per course per teacher in a week. Please help me to achieve that.
My efforts so far have been very inefficient.
I calculated the formula in B71 for each row in the entire time-table and added all the quantities in B70. However I need to have a comprehensive list of all courses with divisions for all teachers. I am not being able to generate that.
Thanks in advance.
You where pretty close in your attempt. You could use the following in B70 and fill down and to the right:
=COUNTIFS($C$10:$P$67,$A70,$C$11:$P$68,B$69)

Excel - Automatic allocation of preferences

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.

Excel - What is the easiest way to calculate incidence plus prevalence over time?

Say I have the dataset below, what is the most efficient formula to fill the cells in column D, where the number of patients alive are calculated?
Example data set in excel
The way it should calculate is:
month 1: 8*100% = 8
Month 2: 8*80%+6*100% = 12.4
Month 3: 8*75%+6*80%+9*100% = 19.8
...
Month 10: etc.
The problem that I have is that which each row, the formula becomes longer. It is feasible to just manually enter the formulas for small datasets, but as datasets become larger, this task becomes unfeasible.
I have been able to use VBA to code the survival of the number of new patients column (C). But then I would have to rerun the VBA code as soon as I change a single value in that column.
I have a feeling it should be possible with some combination of the INDEX function in excel, I just haven't been able to figure it out.
Who can help me out here?
Kind regards,
Sander
If moving the data a bit is allowed at least for the calculation, you could do something like this:
=SUMPRODUCT($F$11:$F$20,B2:B11)
It uses a reversed list of your current list of new patients. That list is created with (formula obtained from this site):
=INDEX($C$11:$C$20,COUNTA($C$11:$C$20)+ROW($C$11:$C$20)-ROW())
Result:
The added space is necessary for the formula to work (so that it gets 0% for patients not present yet).
Or one where you don't have to leave spaces (everything from above is reversed however):
=SUMPRODUCT($C$2:$C$11,G11:G20)

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.

AverageIf and Multiple data strings

I'm involved with a youth football tournament on the referee side, with assessing/coaching the referees. I've just taken over doing the data entry for the referees assessment scores which we then use to determine who gets finals etc and am looking to extract more usable information from the data to help us identify trends.
I've got (up to) 200 referees, each receiving from none to two assessment scores each day for 5 days. The scores are entered as both the raw mark and the weighted mark based on match difficulty (along with a host of other data about the match that isn't relevant to this issue.
I can extract the average mark (raw and weighted) across all referees without issues and have done so using the below formula, which is the raw average mark:
=AVERAGE(Working!AK4:AK200,Working!BK4:BK200,Working!CL4:CL200,Working!DL4:DL200,Working!EM4:EM200,Working!FM4:FM200,Working!GN4:GN200,Working!HN4:HN200,Working!IO4:IO200,Working!JO4:JO200)
But I also want to extract the average mark (raw and weighted) across two subsets - Academy and non academy referees, to help plot trends and determine where resources need to be utilised.
I've attempted to use an AVERAGEIF formula, but am getting a #VALUE! return. This is the formula that I've attempted to use to return the average raw mark for those referees in the academy:
=AVERAGEIF(Working!G4:G200,Working!G4:G200="Yes",(Working!AK4:AK200,Working!BK4:BK200,Working!CL4:CL200,Working!DL4:DL200,Working!EM4:EM200,Working!FM4:FM200,Working!GN4:GN200,Working!HN4:HN200,Working!IO4:IO200,Working!JO4:JO200))
If I do the same formula as above, but without the brackets around the [average_range], I get a 'you've used too many arguments, and it highlights BK200.
From what I've been able to find so far online, it seems that the formula I'm trying to use would only work if ALL the cells in (Working!G4:G200) returned "Yes". However if there are only 50 academy referees as indicated by "Yes" in G column, then I want those specific scores to be averaged, and the inverse for the non-academy referees.
I thought about having another sheet, which would simply contain populate from Column G (a simple =G4 and then populated down to =G200 next to all of the scores), consolidated into a block of raw marks columned under Assessment 1, 2, 3, 4.... and then the same for all of the weighted marks which would populate from the equivalent cell on the working sheet, but there's a lot of filtering, and re-sorting that goes on on the working sheet, and I'm not 100% certain that that wouldn't cause issues.
Any feedback on how to work through this problem, so that I can display the overall average mark for academy and non-academy referees in both raw and weighted form would be much appreciated, and I apologize if this post is rather convoluted.
I don't think there is a neat solution if the scores are in several columns which are not consecutive.
My suggestion is:-
(1) Work out the sum for each column separately and total them up
(2) Work out the count for each column separately and total them up
(3) Divide Sum by Count to get Average.
In my small example below with 3 referees and 3 columns:-
(1) In K2:-
=SUMIF(H2:H4,"Yes",B2:B4)+SUMIF(H2:H4,"Yes",D2:D4)+SUMIF(H2:H4,"Yes",F2:F4)
(2) In K3:-
=COUNTIFS(B2:B4,">=0",H2:H4,"Yes")+COUNTIFS(D2:D4,">=0",H2:H4,"Yes")+COUNTIFS(F2:F4,">=0",H2:H4,"Yes")
(3) In K4:
=K2/K3
This would include any zero scores (if this is possible) but exclude any blanks.
You can then scale it up to your data.
Beyond this, you would have to change the data structure either
(1) Add a row to label the columns that you want to average e.g.
Score 1 Score 2 Score 3
3 0 3
so you could pick up only the columns labelled 3 say
Here's how it would be in my small example:-
In K3:-
=SUM((B$2:F$2=3)*($H3:$H5="Yes")*B3:F5)
Which is an array formula and must be entered with Ctrl-Shift-Enter
In K4:-
=SUM((B$2:F$2=3)*($H3:$H5="Yes")*(B3:F5<>""))
another array formula
In K5:-
=K3/K4
This is how the columns you want are labelled with a 3 in row 2, so it ignores the other columns:-
(2) Consolidate them into another sheet as you suggest.

Resources