Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I assumed that your data table is in range A1:E7.</p> <p><strong>Step 1. Create a list of choices for each kid</strong></p> <p>For each kid create a list with all their preferences listed (at the end of the list I added "-" as placeholders). Enter this formula in G2 and drag to range G2:J7:</p> <pre><code>=IF(G1="-";"-";IF(ISNA(OFFSET($A$1;IFERROR(MATCH(G1;$A$2:$A$7;0);0)+ MATCH("x";OFFSET(B$2;IFERROR(MATCH(G1;$A$2:$A$7;0);0);0;7;1);0);0;1;1)); "-";OFFSET($A$1;IFERROR(MATCH(G1;$A$2:$A$7;0);0)+MATCH("x";OFFSET(B$2; IFERROR(MATCH(G1;$A$2:$A$7;0);0);0;7;1);0);0;1;1))) </code></pre> <p>Also put kids names above data columns (G1:J1).</p> <p><strong>Step 2. Create conditional data validation</strong></p> <p>Given that your first data validation list (name) is in cell L2 and you've followed step 1, use this formula for data validation for food:</p> <pre><code>=OFFSET(F$2;0;MATCH(L2;$G$1:$J$1;0);6-COUNTIF(OFFSET(F$2:F$7;0; MATCH(L2;$G$1:$J$1;0));"-")) </code></pre> <p>This formula both excludes all empty choices ("-") in the list and gives the right list based on kid's name.</p> <hr> <p><strong>UPDATE. Alternative solution with INDEX/MATCH</strong></p> <p>OFFSET is a volatile formula (i.e. Excel recalculates it whenever there is any change in your workbook) so you might want to do this with INDEX instead. Here is the formula for my step 1 above:</p> <pre><code>=IF(G1="-";"-";IFERROR(INDEX($A$2:$A$7;IFERROR(MATCH(G1;$A$2:$A$7;0);0)+ MATCH("x";INDEX(B$2:B$7;IFERROR(MATCH(G1;$A$2:$A$7;0)+1;1);1):B$7;0);1);"-")) </code></pre> <p>As for the step two, it seems that formula for data validation gets recalculated only when you select the cell so OFFSET doesn't have volatility in data validation lists. As INDEX cannot return a range and Excel doesn't allow INDEX(..):INDEX(..) ranges for data validation, OFFSET is better for data validation lists.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload