How to limit the number of choices based on a value?

studentlearner

New Member
Joined
Oct 7, 2021
Messages
30
Office Version
  1. 365
Platform
  1. Windows
So I'm trying to limit the number of times each respective project can be repeated based on the table that starts on D18 (the no of available projects table), So this is how the table looks like at the moment:

ExcelAutomationSPT (1).xlsm
ABCDEF
1Employee NameAttendance PercentageChoice1Choice2Choice3FinalChoice
2Alan92Project 1Project 2Project 3Project 1
3John89.66666667Project 2Project 1Project 3Project 2
4Aaron85Project 3Project 2Project 1Project 3
5Chris84.33333333Project 1Project 2Project 3NIL
6Tommy81.66666667Project 1Project 3Project 2NIL
7Jack81.33333333Project 1Project 3Project 2NIL
8Bob75.09333333Project 2Project 1Project 3NIL
9Ethan73.15Project 1Project 3Project 2NIL
10Fred73Project 2Project 3Project 1NIL
11Sam60Project 3Project 1Project 2NIL
12Ken55Project 1Project 2Project 3NIL
13Sasuke52Project 2Project 3Project 1NIL
14
15
16
17ProjectNo Of Available Position
18Project 13
19Project 24
20Project 34
Final
Cell Formulas
RangeFormula
F2:F13F2=INDEX(FILTER(C2:E2,ISNA(MATCH(C2:E2,F$1:F1,0)),"NIL"),1)



And this is how it should look like at the end:
Do notice that the final choice limits itself based on the values at D18:D20, any help with formula or VBA would be great, Thank you!

ExcelAutomationSPT (1).xlsm
ABCDEF
1Employee NameAttendance PercentageChoice1Choice2Choice3FinalChoice
2Alan92Project 1Project 2Project 3Project 1
3John89.66666667Project 2Project 1Project 3Project 2
4Aaron85Project 3Project 2Project 1Project 3
5Chris84.33333333Project 1Project 2Project 3Project 1
6Tommy81.66666667Project 1Project 3Project 2Project 1
7Jack81.33333333Project 1Project 3Project 2Project 3
8Bob75.09333333Project 2Project 1Project 3Project 2
9Ethan73.15Project 1Project 3Project 2Project 3
10Fred73Project 2Project 3Project 1Project 2
11Sam60Project 3Project 1Project 2Project 3
12Ken55Project 1Project 2Project 3Project 2
13Sasuke52Project 2Project 3Project 1NIL
14
15
16
17ProjectNo Of Available Position
18Project 13
19Project 24
20Project 34
Final
Cell Formulas
RangeFormula
F2:F4,F13F2=INDEX(FILTER(C2:E2,ISNA(MATCH(C2:E2,F$1:F1,0)),"NIL"),1)
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
A brute force approach.
Excel Formula:
=IF(COUNTIFS(F$1:F1,C2)<VLOOKUP(C2,$C$18:$D$20,2,0),C2,IF(COUNTIFS(F$1:F1,D2)<VLOOKUP(D2,$C$18:$D$20,2,0),D2,IF(COUNTIFS(F$1:F1,E2)<VLOOKUP(E2,$C$18:$D$20,2,0),E2,"Nil")))
 
Upvote 0
Solution

Forum statistics

Threads
1,223,903
Messages
6,175,284
Members
452,630
Latest member
OdubiYouth

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