Help creating model to allocate preferred choices but with limited no. of allocations per choice to maximize ranked preferences

sjf92

New Member
Joined
Mar 8, 2024
Messages
2
Office Version
  1. 365
Platform
  1. Windows
Windows 365
I have a 334 students. I have 17 pathways (choices) with a limited number of spaces per pathway. Students are able to select 5 pathways and rank them in terms of preference (1 being most preferred and 5 being the least). I would like to enter the preference data into a model/formula in Excel that will then tell me the allocation of topics to students that will maximize the preferences of the greatest number of students.
If there is an existing tutorial or thread that provides an answer, I'd be grateful for any leads. I have only the most basic proficiency in Excel and thus will need a simple step-by-step explanation of how to build this model.

PathwayAvailable Spaces
ACC
22​
BE
20​
CF
18​
CVS
20​
Endo
32​
GAH
21​
GH
25​
HPL
18​
II
20​
M
40​
NEU
32​
HAEM
15​
PH
30​
RM
16​
RDS
30​
SDT
20​
TRM
25​
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
One possible way...
You'll need to set your sheet out exactly as I've indicated below. Note that the Pathway list has been sorted by available spaces (largest to smallest) and that your student list starts in cell D2 - with headers in row 1. I've randomly picked the students' preferences to test the code. Put the code below in a standard module. I've shown the sheet before and after the code is run.
With the 334 randomly selected preferences, it results in 308 getting their 1st preference; 21 getting their second; 4 their 3rd and 1 their 4th. There may be a more equitable way of doing this, but this is what I came up with.

The code:
VBA Code:
Option Explicit
Sub Allocate_Pathways()
    Application.ScreenUpdating = False
    Dim ws As Worksheet
    Set ws = Sheets("Sheet1")   '<-- *** Change sheet name to suit ***
    Dim r As Range, LRow As Long
    Set r = ws.Range("D2:K" & ws.Cells(Rows.Count, "D").End(xlUp).Row)
    LRow = r.Columns(1).Cells.Count
    
    Dim a
    a = ws.Range("A2", ws.Cells(Rows.Count, "B").End(xlUp))
    Dim s As String, i As Long, j As Long, k As Long, n As Long
    For k = 2 To 6
        For i = 1 To UBound(a, 1)
            s = a(i, 1)
            n = a(i, 2) - WorksheetFunction.CountIf(r.Columns(7), s)
            For j = 1 To LRow 'r.Columns(1).Cells.Count
                If n > 0 And r.Cells(j, k) = s And r.Cells(j, 7) = "" Then
                    r.Cells(j, 7) = s
                    n = n - 1
                End If
            Next j
        Next i
    Next k
    
    ws.Range("J1").Resize(1, 2).Value = Array("Pathway", "Preference")
    With r.Columns(8)
        .FormulaR1C1 = "=Match(RC[-1],RC[-6]:RC[-2],0)"
        .Value = .Value
    End With
    Application.ScreenUpdating = False
End Sub

Before (only the first 300 students shown due to XL2BB limits):
TEST ALLOCATION.xlsm
ABCDEFGHI
1PathwayAvailable spacesStudent1st2nd3rd4th5th
2M40Student 1RMEndoCVSGHII
3Endo32Student 2NEUHPLBEMPH
4NEU32Student 3GAHCVSCFBEPH
5PH30Student 4HPLTRMIIBERDS
6RDS30Student 5GAHIIHPLACCGH
7GH25Student 6GAHIIPHEndoM
8TRM25Student 7ACCGHBEMTRM
9ACC22Student 8NEUCVSBEIIHPL
10GAH21Student 9CVSACCTRMCFGH
11BE20Student 10HPLRMTRMMGH
12CVS20Student 11SDTMGAHHAEMACC
13II20Student 12IIHPLCFEndoNEU
14SDT20Student 13TRMPHEndoSDTGAH
15CF18Student 14EndoIIMHAEMHPL
16HPL18Student 15CVSRDSGHGAHACC
17RM16Student 16TRMHPLGAHIIM
18HAEM15Student 17BEPHSDTHPLNEU
19Student 18HAEMPHCFACCGH
20Student 19HPLEndoGAHACCNEU
21Student 20HAEMPHBEMNEU
22Student 21NEUHAEMHPLPHGAH
23Student 22NEUACCCFCVSM
24Student 23BEHPLEndoRMGAH
25Student 24SDTCFPHMGH
26Student 25TRMCVSGHNEUBE
27Student 26ACCRMHPLIIM
28Student 27GAHNEUGHACCHPL
29Student 28TRMGAHHAEMEndoM
30Student 29TRMCFEndoMRM
31Student 30IIGAHGHRMNEU
32Student 31RMCFTRMRDSCVS
33Student 32PHACCCVSRMSDT
34Student 33EndoGHGAHCFHPL
35Student 34NEUCVSGAHPHRDS
36Student 35ACCPHGHIIBE
37Student 36ACCIITRMPHBE
38Student 37BECFIIEndoHPL
39Student 38GHRMGAHIIRDS
40Student 39BEGHMPHCF
41Student 40NEUACCSDTCVSRM
42Student 41GHHPLTRMEndoRM
43Student 42GHRMMCVSNEU
44Student 43CFGHBEEndoPH
45Student 44NEUGAHTRMMII
46Student 45PHRMHPLBEACC
47Student 46CFSDTTRMNEUGH
48Student 47BEGHMPHNEU
49Student 48BEHAEMMSDTCVS
50Student 49IIHPLCFCVSNEU
51Student 50NEUACCIIHPLSDT
52Student 51BEHPLRDSHAEMEndo
53Student 52CFNEUHAEMTRMPH
54Student 53CFGAHSDTNEUBE
55Student 54SDTIIHPLTRMM
56Student 55EndoBEGAHCFRM
57Student 56BEGHTRMMCF
58Student 57IICFEndoMRM
59Student 58CFNEURMACCM
60Student 59RDSCVSGHPHII
61Student 60HAEMMSDTGHII
62Student 61ACCCVSGAHPHRM
63Student 62NEUHAEMHPLSDTM
64Student 63CFMGHRMEndo
65Student 64IIGAHRDSPHM
66Student 65RDSIIHAEMSDTNEU
67Student 66RDSPHACCRMTRM
68Student 67GHGAHHPLRDSRM
69Student 68HAEMPHGAHCFNEU
70Student 69NEUBECVSMCF
71Student 70GAHCVSIIRDSACC
72Student 71BECFIIHPLRDS
73Student 72ACCTRMCVSHAEMSDT
74Student 73ACCMBEIISDT
75Student 74TRMACCPHEndoII
76Student 75RDSTRMRMSDTHAEM
77Student 76BETRMCVSPHGAH
78Student 77HAEMHPLRMCFII
79Student 78ACCHPLGAHNEURDS
80Student 79IIHAEMPHCFTRM
81Student 80ACCGAHCFTRMCVS
82Student 81BEMCVSPHCF
83Student 82HAEMSDTCFPHGAH
84Student 83GHSDTIICFM
85Student 84RMNEUMIICF
86Student 85PHMACCNEUII
87Student 86GAHGHSDTNEUCVS
88Student 87PHHPLCVSHAEMACC
89Student 88SDTCFMNEUII
90Student 89CFTRMSDTNEUM
91Student 90CVSSDTRMMTRM
92Student 91RMSDTPHEndoM
93Student 92RMACCGAHNEUII
94Student 93PHRMNEUMII
95Student 94MGAHACCNEUII
96Student 95CFHAEMTRMGHBE
97Student 96BENEUGAHRMII
98Student 97RDSSDTPHRMHPL
99Student 98ACCIIHAEMBECVS
100Student 99IIGAHPHTRMRM
101Student 100RDSSDTTRMGHM
102Student 101MCVSRMNEUII
103Student 102EndoGHSDTRDSTRM
104Student 103IIBECVSCFTRM
105Student 104EndoTRMBECVSM
106Student 105EndoHPLBERDSII
107Student 106CFHPLBESDTM
108Student 107GAHRDSSDTBERM
109Student 108NEUIIHPLSDTACC
110Student 109GHHPLEndoNEUHAEM
111Student 110EndoPHHAEMACCM
112Student 111SDTMHPLGAHRDS
113Student 112TRMHPLNEUMRM
114Student 113RDSPHNEUGAHRM
115Student 114IIGHMTRMRDS
116Student 115TRMNEUIIGAHGH
117Student 116ACCCVSGHEndoGAH
118Student 117GAHTRMRMCVSSDT
119Student 118PHTRMMNEUGAH
120Student 119IIRDSRMCFACC
121Student 120NEUBERDSGHPH
122Student 121CFIIHAEMGAHCVS
123Student 122NEURDSMGHGAH
124Student 123GAHSDTCFIIRDS
125Student 124ACCHAEMPHRMCVS
126Student 125PHACCRMSDTHAEM
127Student 126HAEMMBERMRDS
128Student 127RDSNEUSDTIIGAH
129Student 128CVSPHNEUCFHPL
130Student 129GAHCFMRDSCVS
131Student 130GAHBEEndoCVSRDS
132Student 131ACCIIGHTRMBE
133Student 132NEUGHRDSIIACC
134Student 133NEURMACCSDTII
135Student 134GAHSDTACCGHCF
136Student 135IIHPLCVSRMRDS
137Student 136IIRDSHPLMHAEM
138Student 137TRMACCHPLMEndo
139Student 138IIHPLCVSRDSNEU
140Student 139HAEMPHEndoSDTM
141Student 140NEUIIHPLSDTM
142Student 141CFGAHBESDTEndo
143Student 142GHCVSHPLCFSDT
144Student 143IICVSGHSDTHPL
145Student 144CVSACCMIISDT
146Student 145ACCGAHCFHPLEndo
147Student 146TRMACCHAEMMSDT
148Student 147BEGHEndoMNEU
149Student 148PHTRMIIEndoNEU
150Student 149GHACCSDTRDSCVS
151Student 150NEUPHEndoMCVS
152Student 151RDSCVSIIACCRM
153Student 152ACCRMHPLPHGH
154Student 153CFHAEMMPHII
155Student 154EndoGAHSDTIIHAEM
156Student 155GAHMTRMCVSHAEM
157Student 156GAHPHHPLGHII
158Student 157BETRMHPLSDTGAH
159Student 158CVSIIACCMGH
160Student 159GAHTRMACCSDTRDS
161Student 160BECVSEndoACCRM
162Student 161IIHAEMRMBEEndo
163Student 162IIACCMEndoHPL
164Student 163EndoGAHPHRMII
165Student 164HPLIIEndoRMTRM
166Student 165RDSNEUTRMCFII
167Student 166RDSNEUGHCFTRM
168Student 167TRMRDSHPLSDTRM
169Student 168RDSHPLCVSIINEU
170Student 169MGHHPLHAEMII
171Student 170NEUGAHIIHAEMCVS
172Student 171GAHEndoRDSHAEMSDT
173Student 172CFGAHACCIIHPL
174Student 173HPLRMHAEMMII
175Student 174GAHMBEGHSDT
176Student 175TRMGHCFRMPH
177Student 176IIMACCNEURDS
178Student 177IICFTRMHPLGH
179Student 178RDSTRMHAEMIIPH
180Student 179IICVSHAEMMEndo
181Student 180MHPLPHTRMGAH
182Student 181PHCVSGAHACCNEU
183Student 182RMMBEGHII
184Student 183PHCFRDSRMEndo
185Student 184NEUIIBEGAHM
186Student 185HPLRDSNEUPHEndo
187Student 186IIGAHSDTACCCF
188Student 187CFEndoRMTRMNEU
189Student 188HPLGAHCVSEndoNEU
190Student 189MGAHSDTNEUACC
191Student 190RDSPHMIIBE
192Student 191MTRMHAEMIISDT
193Student 192HPLIIGAHNEUTRM
194Student 193HPLNEUEndoCVSACC
195Student 194BETRMACCMEndo
196Student 195NEURMACCGAHGH
197Student 196CVSHAEMGAHBEGH
198Student 197ACCCVSGHTRMRM
199Student 198HAEMGHSDTNEURDS
200Student 199TRMHPLNEUMGAH
201Student 200CVSIICFEndoM
202Student 201HAEMCFIIGAHBE
203Student 202IIHPLGHEndoGAH
204Student 203HPLTRMIIRMACC
205Student 204HAEMCFHPLACCGAH
206Student 205SDTHPLGHGAHM
207Student 206SDTCVSCFGHEndo
208Student 207HAEMGHPHRDSM
209Student 208PHBEMEndoRM
210Student 209RMCFSDTCVSACC
211Student 210RMGAHCFPHRDS
212Student 211MHAEMTRMGAHNEU
213Student 212CFPHRDSNEUHPL
214Student 213ACCNEUGHIICF
215Student 214BESDTCFHPLTRM
216Student 215IIGHEndoMNEU
217Student 216TRMSDTBERMM
218Student 217PHRMHAEMNEUSDT
219Student 218IIACCMGAHTRM
220Student 219ACCGHHPLMPH
221Student 220CVSEndoACCRMSDT
222Student 221NEUHPLRMRDSHAEM
223Student 222PHACCMIISDT
224Student 223SDTHAEMCVSHPLPH
225Student 224RMCVSMIIGAH
226Student 225CVSACCHPLSDTEndo
227Student 226EndoPHIIRMBE
228Student 227TRMNEURDSCVSRM
229Student 228CFSDTMIIACC
230Student 229RMMCVSRDSNEU
231Student 230CFPHGHSDTNEU
232Student 231RMSDTTRMMII
233Student 232CVSCFNEUACCSDT
234Student 233GHBEMACCSDT
235Student 234CVSHAEMMNEURDS
236Student 235GHCVSMCFII
237Student 236EndoRDSCVSMNEU
238Student 237MPHGAHIIHAEM
239Student 238CFIIPHMGH
240Student 239CFSDTMRMEndo
241Student 240MNEUSDTTRMRDS
242Student 241RMRDSNEUIISDT
243Student 242GHACCCVSRMSDT
244Student 243HAEMNEUEndoIIM
245Student 244GHTRMRMMCVS
246Student 245CVSCFSDTHAEMACC
247Student 246RDSNEUMSDTTRM
248Student 247IIHAEMTRMMEndo
249Student 248CFSDTNEUEndoGAH
250Student 249ACCHPLRDSGHII
251Student 250HPLEndoCFHAEMSDT
252Student 251ACCTRMHAEMCFGAH
253Student 252TRMACCMIIRM
254Student 253RDSCFRMGHHAEM
255Student 254TRMBESDTNEUGAH
256Student 255TRMRDSACCNEUEndo
257Student 256HAEMHPLMBEGH
258Student 257HAEMTRMHPLRMCF
259Student 258GHPHHAEMNEUM
260Student 259SDTPHGHMBE
261Student 260CVSIIGHMNEU
262Student 261NEUBESDTGAHRM
263Student 262EndoNEUCVSRMHAEM
264Student 263MGAHNEUGHRM
265Student 264BERMTRMCVSSDT
266Student 265BECFNEURDSHAEM
267Student 266HPLBEPHACCII
268Student 267HAEMMBENEUGAH
269Student 268RDSNEUTRMPHCF
270Student 269GAHNEUCFRDSRM
271Student 270TRMCFHPLCVSM
272Student 271PHIIACCHPLRM
273Student 272CVSMRMACCGAH
274Student 273PHEndoGAHIIGH
275Student 274EndoPHGHBEACC
276Student 275CFMHAEMACCPH
277Student 276HPLMTRMGHSDT
278Student 277ACCCFHAEMPHGAH
279Student 278RMGHCFRDSM
280Student 279HAEMPHMNEUII
281Student 280HAEMTRMMBEACC
282Student 281RDSGAHACCPHRM
283Student 282ACCRMBEGHM
284Student 283IIMSDTCVSBE
285Student 284CFNEUEndoGHHPL
286Student 285GAHBEPHTRMCVS
287Student 286IISDTPHACCM
288Student 287MHAEMSDTCFTRM
289Student 288TRMMIIGHNEU
290Student 289MBENEUPHSDT
291Student 290HPLIIMRDSTRM
292Student 291PHBECFIISDT
293Student 292ACCMGAHTRMRM
294Student 293RDSIIGHNEUACC
295Student 294BEIIHPLCVSEndo
296Student 295RMMPHNEUII
297Student 296NEUHPLIIMPH
298Student 297NEUIIRMPHGH
299Student 298TRMMHPLNEUBE
300Student 299MIICFGHHAEM
301Student 300NEUTRMHPLMCVS
Sheet1


After (only the first 250 students shown due to XL2BB limits):
TEST ALLOCATION.xlsm
ABCDEFGHIJK
1PathwayAvailable spacesStudent1st2nd3rd4th5thPathwayPreference
2M40Student 1RMEndoCVSGHIIRM1
3Endo32Student 2NEUHPLBEMPHNEU1
4NEU32Student 3GAHCVSCFBEPHGAH1
5PH30Student 4HPLTRMIIBERDSHPL1
6RDS30Student 5GAHIIHPLACCGHGAH1
7GH25Student 6GAHIIPHEndoMGAH1
8TRM25Student 7ACCGHBEMTRMACC1
9ACC22Student 8NEUCVSBEIIHPLNEU1
10GAH21Student 9CVSACCTRMCFGHCVS1
11BE20Student 10HPLRMTRMMGHHPL1
12CVS20Student 11SDTMGAHHAEMACCSDT1
13II20Student 12IIHPLCFEndoNEUII1
14SDT20Student 13TRMPHEndoSDTGAHTRM1
15CF18Student 14EndoIIMHAEMHPLEndo1
16HPL18Student 15CVSRDSGHGAHACCCVS1
17RM16Student 16TRMHPLGAHIIMTRM1
18HAEM15Student 17BEPHSDTHPLNEUBE1
19Student 18HAEMPHCFACCGHHAEM1
20Student 19HPLEndoGAHACCNEUHPL1
21Student 20HAEMPHBEMNEUHAEM1
22Student 21NEUHAEMHPLPHGAHNEU1
23Student 22NEUACCCFCVSMNEU1
24Student 23BEHPLEndoRMGAHBE1
25Student 24SDTCFPHMGHSDT1
26Student 25TRMCVSGHNEUBETRM1
27Student 26ACCRMHPLIIMACC1
28Student 27GAHNEUGHACCHPLGAH1
29Student 28TRMGAHHAEMEndoMTRM1
30Student 29TRMCFEndoMRMTRM1
31Student 30IIGAHGHRMNEUII1
32Student 31RMCFTRMRDSCVSRM1
33Student 32PHACCCVSRMSDTPH1
34Student 33EndoGHGAHCFHPLEndo1
35Student 34NEUCVSGAHPHRDSNEU1
36Student 35ACCPHGHIIBEACC1
37Student 36ACCIITRMPHBEACC1
38Student 37BECFIIEndoHPLBE1
39Student 38GHRMGAHIIRDSGH1
40Student 39BEGHMPHCFBE1
41Student 40NEUACCSDTCVSRMNEU1
42Student 41GHHPLTRMEndoRMGH1
43Student 42GHRMMCVSNEUGH1
44Student 43CFGHBEEndoPHCF1
45Student 44NEUGAHTRMMIINEU1
46Student 45PHRMHPLBEACCPH1
47Student 46CFSDTTRMNEUGHCF1
48Student 47BEGHMPHNEUBE1
49Student 48BEHAEMMSDTCVSBE1
50Student 49IIHPLCFCVSNEUII1
51Student 50NEUACCIIHPLSDTNEU1
52Student 51BEHPLRDSHAEMEndoBE1
53Student 52CFNEUHAEMTRMPHCF1
54Student 53CFGAHSDTNEUBECF1
55Student 54SDTIIHPLTRMMSDT1
56Student 55EndoBEGAHCFRMEndo1
57Student 56BEGHTRMMCFBE1
58Student 57IICFEndoMRMII1
59Student 58CFNEURMACCMCF1
60Student 59RDSCVSGHPHIIRDS1
61Student 60HAEMMSDTGHIIHAEM1
62Student 61ACCCVSGAHPHRMACC1
63Student 62NEUHAEMHPLSDTMNEU1
64Student 63CFMGHRMEndoCF1
65Student 64IIGAHRDSPHMII1
66Student 65RDSIIHAEMSDTNEURDS1
67Student 66RDSPHACCRMTRMRDS1
68Student 67GHGAHHPLRDSRMGH1
69Student 68HAEMPHGAHCFNEUHAEM1
70Student 69NEUBECVSMCFNEU1
71Student 70GAHCVSIIRDSACCGAH1
72Student 71BECFIIHPLRDSBE1
73Student 72ACCTRMCVSHAEMSDTACC1
74Student 73ACCMBEIISDTACC1
75Student 74TRMACCPHEndoIITRM1
76Student 75RDSTRMRMSDTHAEMRDS1
77Student 76BETRMCVSPHGAHBE1
78Student 77HAEMHPLRMCFIIHAEM1
79Student 78ACCHPLGAHNEURDSACC1
80Student 79IIHAEMPHCFTRMII1
81Student 80ACCGAHCFTRMCVSACC1
82Student 81BEMCVSPHCFBE1
83Student 82HAEMSDTCFPHGAHHAEM1
84Student 83GHSDTIICFMGH1
85Student 84RMNEUMIICFRM1
86Student 85PHMACCNEUIIPH1
87Student 86GAHGHSDTNEUCVSGAH1
88Student 87PHHPLCVSHAEMACCPH1
89Student 88SDTCFMNEUIISDT1
90Student 89CFTRMSDTNEUMCF1
91Student 90CVSSDTRMMTRMCVS1
92Student 91RMSDTPHEndoMRM1
93Student 92RMACCGAHNEUIIRM1
94Student 93PHRMNEUMIIPH1
95Student 94MGAHACCNEUIIM1
96Student 95CFHAEMTRMGHBECF1
97Student 96BENEUGAHRMIIBE1
98Student 97RDSSDTPHRMHPLRDS1
99Student 98ACCIIHAEMBECVSACC1
100Student 99IIGAHPHTRMRMII1
101Student 100RDSSDTTRMGHMRDS1
102Student 101MCVSRMNEUIIM1
103Student 102EndoGHSDTRDSTRMEndo1
104Student 103IIBECVSCFTRMII1
105Student 104EndoTRMBECVSMEndo1
106Student 105EndoHPLBERDSIIEndo1
107Student 106CFHPLBESDTMCF1
108Student 107GAHRDSSDTBERMGAH1
109Student 108NEUIIHPLSDTACCNEU1
110Student 109GHHPLEndoNEUHAEMGH1
111Student 110EndoPHHAEMACCMEndo1
112Student 111SDTMHPLGAHRDSSDT1
113Student 112TRMHPLNEUMRMTRM1
114Student 113RDSPHNEUGAHRMRDS1
115Student 114IIGHMTRMRDSII1
116Student 115TRMNEUIIGAHGHTRM1
117Student 116ACCCVSGHEndoGAHACC1
118Student 117GAHTRMRMCVSSDTGAH1
119Student 118PHTRMMNEUGAHPH1
120Student 119IIRDSRMCFACCII1
121Student 120NEUBERDSGHPHNEU1
122Student 121CFIIHAEMGAHCVSCF1
123Student 122NEURDSMGHGAHNEU1
124Student 123GAHSDTCFIIRDSGAH1
125Student 124ACCHAEMPHRMCVSACC1
126Student 125PHACCRMSDTHAEMPH1
127Student 126HAEMMBERMRDSHAEM1
128Student 127RDSNEUSDTIIGAHRDS1
129Student 128CVSPHNEUCFHPLCVS1
130Student 129GAHCFMRDSCVSGAH1
131Student 130GAHBEEndoCVSRDSGAH1
132Student 131ACCIIGHTRMBEACC1
133Student 132NEUGHRDSIIACCNEU1
134Student 133NEURMACCSDTIINEU1
135Student 134GAHSDTACCGHCFGAH1
136Student 135IIHPLCVSRMRDSII1
137Student 136IIRDSHPLMHAEMII1
138Student 137TRMACCHPLMEndoTRM1
139Student 138IIHPLCVSRDSNEUII1
140Student 139HAEMPHEndoSDTMHAEM1
141Student 140NEUIIHPLSDTMNEU1
142Student 141CFGAHBESDTEndoCF1
143Student 142GHCVSHPLCFSDTGH1
144Student 143IICVSGHSDTHPLII1
145Student 144CVSACCMIISDTCVS1
146Student 145ACCGAHCFHPLEndoACC1
147Student 146TRMACCHAEMMSDTTRM1
148Student 147BEGHEndoMNEUBE1
149Student 148PHTRMIIEndoNEUPH1
150Student 149GHACCSDTRDSCVSGH1
151Student 150NEUPHEndoMCVSNEU1
152Student 151RDSCVSIIACCRMRDS1
153Student 152ACCRMHPLPHGHACC1
154Student 153CFHAEMMPHIICF1
155Student 154EndoGAHSDTIIHAEMEndo1
156Student 155GAHMTRMCVSHAEMGAH1
157Student 156GAHPHHPLGHIIGAH1
158Student 157BETRMHPLSDTGAHBE1
159Student 158CVSIIACCMGHCVS1
160Student 159GAHTRMACCSDTRDSGAH1
161Student 160BECVSEndoACCRMBE1
162Student 161IIHAEMRMBEEndoII1
163Student 162IIACCMEndoHPLII1
164Student 163EndoGAHPHRMIIEndo1
165Student 164HPLIIEndoRMTRMHPL1
166Student 165RDSNEUTRMCFIIRDS1
167Student 166RDSNEUGHCFTRMRDS1
168Student 167TRMRDSHPLSDTRMTRM1
169Student 168RDSHPLCVSIINEURDS1
170Student 169MGHHPLHAEMIIM1
171Student 170NEUGAHIIHAEMCVSNEU1
172Student 171GAHEndoRDSHAEMSDTGAH1
173Student 172CFGAHACCIIHPLCF1
174Student 173HPLRMHAEMMIIHPL1
175Student 174GAHMBEGHSDTGAH1
176Student 175TRMGHCFRMPHTRM1
177Student 176IIMACCNEURDSII1
178Student 177IICFTRMHPLGHII1
179Student 178RDSTRMHAEMIIPHRDS1
180Student 179IICVSHAEMMEndoII1
181Student 180MHPLPHTRMGAHM1
182Student 181PHCVSGAHACCNEUPH1
183Student 182RMMBEGHIIRM1
184Student 183PHCFRDSRMEndoPH1
185Student 184NEUIIBEGAHMNEU1
186Student 185HPLRDSNEUPHEndoHPL1
187Student 186IIGAHSDTACCCFII1
188Student 187CFEndoRMTRMNEUCF1
189Student 188HPLGAHCVSEndoNEUHPL1
190Student 189MGAHSDTNEUACCM1
191Student 190RDSPHMIIBERDS1
192Student 191MTRMHAEMIISDTM1
193Student 192HPLIIGAHNEUTRMHPL1
194Student 193HPLNEUEndoCVSACCHPL1
195Student 194BETRMACCMEndoBE1
196Student 195NEURMACCGAHGHNEU1
197Student 196CVSHAEMGAHBEGHCVS1
198Student 197ACCCVSGHTRMRMACC1
199Student 198HAEMGHSDTNEURDSHAEM1
200Student 199TRMHPLNEUMGAHTRM1
201Student 200CVSIICFEndoMCVS1
202Student 201HAEMCFIIGAHBEHAEM1
203Student 202IIHPLGHEndoGAHHPL2
204Student 203HPLTRMIIRMACCHPL1
205Student 204HAEMCFHPLACCGAHHAEM1
206Student 205SDTHPLGHGAHMSDT1
207Student 206SDTCVSCFGHEndoSDT1
208Student 207HAEMGHPHRDSMHAEM1
209Student 208PHBEMEndoRMPH1
210Student 209RMCFSDTCVSACCRM1
211Student 210RMGAHCFPHRDSRM1
212Student 211MHAEMTRMGAHNEUM1
213Student 212CFPHRDSNEUHPLCF1
214Student 213ACCNEUGHIICFACC1
215Student 214BESDTCFHPLTRMBE1
216Student 215IIGHEndoMNEUGH2
217Student 216TRMSDTBERMMTRM1
218Student 217PHRMHAEMNEUSDTPH1
219Student 218IIACCMGAHTRMM3
220Student 219ACCGHHPLMPHACC1
221Student 220CVSEndoACCRMSDTCVS1
222Student 221NEUHPLRMRDSHAEMNEU1
223Student 222PHACCMIISDTPH1
224Student 223SDTHAEMCVSHPLPHSDT1
225Student 224RMCVSMIIGAHRM1
226Student 225CVSACCHPLSDTEndoCVS1
227Student 226EndoPHIIRMBEEndo1
228Student 227TRMNEURDSCVSRMTRM1
229Student 228CFSDTMIIACCCF1
230Student 229RMMCVSRDSNEURM1
231Student 230CFPHGHSDTNEUCF1
232Student 231RMSDTTRMMIIRM1
233Student 232CVSCFNEUACCSDTCVS1
234Student 233GHBEMACCSDTGH1
235Student 234CVSHAEMMNEURDSCVS1
236Student 235GHCVSMCFIIGH1
237Student 236EndoRDSCVSMNEUEndo1
238Student 237MPHGAHIIHAEMM1
239Student 238CFIIPHMGHCF1
240Student 239CFSDTMRMEndoSDT2
241Student 240MNEUSDTTRMRDSM1
242Student 241RMRDSNEUIISDTRM1
243Student 242GHACCCVSRMSDTGH1
244Student 243HAEMNEUEndoIIMHAEM1
245Student 244GHTRMRMMCVSGH1
246Student 245CVSCFSDTHAEMACCCVS1
247Student 246RDSNEUMSDTTRMRDS1
248Student 247IIHAEMTRMMEndoTRM3
249Student 248CFSDTNEUEndoGAHSDT2
250Student 249ACCHPLRDSGHIIACC1
251Student 250HPLEndoCFHAEMSDTHPL1
Sheet1
 
Upvote 1
Solution
One possible way...
You'll need to set your sheet out exactly as I've indicated below. Note that the Pathway list has been sorted by available spaces (largest to smallest) and that your student list starts in cell D2 - with headers in row 1. I've randomly picked the students' preferences to test the code. Put the code below in a standard module. I've shown the sheet before and after the code is run.
With the 334 randomly selected preferences, it results in 308 getting their 1st preference; 21 getting their second; 4 their 3rd and 1 their 4th. There may be a more equitable way of doing this, but this is what I came up with.
Great thank you, i'll give this a go!
 
Upvote 0
You don't actually have to sort the pathways by available places - doesn't make any difference.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,175
Members
453,021
Latest member
Justyna P

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