I am going to assume that you have two worksheets in your workbook. Sheet1 is your analysis that will include the validated drop-down box in cell A2. Sheet2 is the file that contains the source table with names and grades.
Here's the layout needed for your source data in Sheet2. In column
B you type the names, and in column
C the grades. You do not need to have them sorted in any particular way. In column
A you type a formula to identify which of the grades in column
C match the value you are looking for (
'Sheet1'!$A$2). This formula will assign a unique number to each row that matches the grade you are looking for.
In column
D you type a simple VLOOKUP formula to list the values you are looking for. This will be the column that your validation will work on. Make sure that each row with data in column
B and
C also contains the formulas in column
A and column
D.
=if($C1='Sheet1'!$A$2;1;0) | A | 1st grade | =iferror(vlookup(row();$A:$B;2;false);"") |
=if($C2='Sheet1'!$A$2;$C1+1;$C1) | B | 1st grade | =iferror(vlookup(row();$A:$B;2;false);"") |
=if($C3='Sheet1'!$A$2;$C2+1;$C2) | C | 1st grade | =iferror(vlookup(row();$A:$B;2;false);"") |
=if($C4='Sheet1'!$A$2;$C3+1;$C3) | D | 1st grade | =iferror(vlookup(row();$A:$B;2;false);"") |
=if($C5='Sheet1'!$A$2;$C4+1;$C4) | E | 1st grade | =iferror(vlookup(row();$A:$B;2;false);"") |
=if($C6='Sheet1'!$A$2;$C5+1;$C5) | Apple | 2nd grade | =iferror(vlookup(row();$A:$B;2;false);"") |
etc | Mango | 2nd grade | etc |
etc | Orange | 2nd grade | etc |
etc | Banana | 2nd grade | etc |
<tbody>
</tbody>
Go to
'Sheet1'!A2 and open the validation field. Select the option "List" and copy the following formula.
=INDIRECT("'Sheet2'!$D$1:$D$"&MAX($A:$A))
That should do it.