How to get the best of 3 choices according to the highest number?

studentlearner

New Member
Joined
Oct 7, 2021
Messages
30
Office Version
  1. 365
Platform
  1. Windows
Can i check how do i get the final choices from this table to the second table?
Employee NameAttendance PercentageChoice1Choice2Choice3
Alan
75.09333333​
Project 1Project 3Project 4
John
73.37​
Project 1Project 4Project 2
Alan
73.15​
Project 3Project 5Project 6
Chris
73.15​
Project 2Project 4Project 1
Tommy
70.63666667​
Project 2Project 6Project 5
Jack
70.63666667​
Project 6Project 1Project 3

the second table:
Employee NameAttendance PercentageChoice1Choice2Choice3Final Choice
Alan
75.09333333​
Project 1Project 3Project 4
Project 1​
John
73.37​
Project 1Project 4Project 2
Project 4​
Alan
73.15​
Project 3Project 5Project 6
Project 3​
Chris
73.15​
Project 2Project 4Project 1
Project 2​
Tommy
70.63666667​
Project 2Project 6Project 5
Project 6​
Jack
70.63666667​
Project 6Project 1Project 3NIL

So it kind of checks the above cell and views whether it was taken and if it was taken it views the second choice and if it was taken it would check the third choice if all choice is taken it will display NIL. Any help with the formula or through VBA would be a great help. Thank you! :)
 
Last edited:

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
Try this VBA

To use it, put this in a cell = AllocateProjects(SelectionTable)
where SelectionTable is the table of choices, ie the three columns headed Choice 1, Choice 2 and Choice 3, but excluding those headings, ie just the table of people's choices
So if Alan's first choice was in D4 (say), then the range would be D4:F9

VBA Code:
Function AllocateProjects(rngProjects As Range)
  Dim r, c, i, j, arrOut, UsedProjects, v
  r = rngProjects.Rows.Count
  c = rngProjects.Columns.Count
  ReDim arrOut(1 To r, 1 To 1)
  For i = 1 To r
    For j = 1 To c
      v = rngProjects.Cells(i, j)
      If InStr(UsedProjects, v) = 0 Then
        arrOut(i, 1) = v
        UsedProjects = UsedProjects & "&" & v
        Exit For
      End If
    Next j
    If arrOut(i, 1) = "" Then arrOut(i, 1) = "NIL"
  Next i
  AllocateProjects = arrOut
End Function
 
Upvote 0
So it kind of checks the above cell and views whether it was taken and if it was taken
Firstly, I am assuming those two Alans are different people. Why can't the second Alan have his first choice since it was not taken by the first Alan or by John?
Similarly, why can't Chris have his first choice?

To my logic, this is a direct worksheet formula solution

21 11 11.xlsm
ABCDEF
1Employee NameAttendance PercentageChoice1Choice2Choice3Final
2Alan 175.09333333Project 1Project 3Project 4Project 1
3John73.37Project 1Project 4Project 2Project 4
4Alan 273.15Project 3Project 5Project 6Project 3
5Chris73.15Project 2Project 4Project 1Project 2
6Tommy70.63666667Project 2Project 6Project 5Project 6
7Jack70.63666667Project 6Project 1Project 3NIL
Choices
Cell Formulas
RangeFormula
F2:F7F2=INDEX(FILTER(C2:E2,ISNA(MATCH(C2:E2,F$1:F1,0)),"NIL"),1)
 
Upvote 0
Solution

Forum statistics

Threads
1,224,822
Messages
6,181,165
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