Sub topic 10
Build Dependent Drop-downs
This chapter assumes you can select ranges, create a basic drop-down, enter formulas, and refer to another sheet with references such as Lists!A2:A.
A dependent drop-down changes its options based on another cell. For example, a user first chooses a category such as Fruit or Vegetables. A second drop-down then shows only items in that category.
Set up the source data
Create a sheet named Lists. Put categories in column A and their items in column B:
| Category | Item |
|---|---|
| Fruit | Apple |
| Fruit | Banana |
| Vegetables | Carrot |
| Vegetables | Spinach |
Create another sheet named Input. Use column A for the category and column B for the dependent item:
| Category | Item |
|---|---|
| Fruit | |
Keep the source data in a simple two-column structure. Each item should have a category in the same row.
Create the first drop-down
Select Input!A2, then choose Data > Data validation > Add rule.
Set the criterion to Drop-down (from a range). Enter:
Lists!A2:AIf repeated category names make the first list untidy, create a separate category list with unique values. For example, use Lists!D2:D for the categories and point the first drop-down at that range.
Choose Done. Cell A2 now controls the choices that will appear in B2.
Filter the second list
The second drop-down needs a range whose contents change when A2 changes. Create a sheet named Helper, then place this formula in Helper!A2:
=FILTER(Lists!B2:B, Lists!A2:A=Input!A2)FILTER returns only the values from Lists!B2:B whose category in column A matches the value in Input!A2. If Input!A2 contains Fruit, the helper range will show Apple and Banana.
The results spill into the cells below the formula. Leave those cells empty. A value in the spill area causes an error and prevents the full list from appearing.
Now select Input!B2. Add a data validation rule with the criterion Drop-down (from a range). Use:
Helper!A2:AWhen you change Input!A2, the formula recalculates and the choices in B2 change.
Extend the pattern to more rows
A single helper range works well for one input row. For several rows, each row needs a helper formula that refers to its own category.
For example, put this formula in Helper!B2:
=FILTER(Lists!B2:B, Lists!A2:A=Input!A3)Use Helper!B2:B as the validation range for Input!B3. Continue with another helper column for each additional input row.
This layout uses extra cells, but it makes each dependency visible and easy to troubleshoot. Clear the old item when the category changes, because Google Sheets does not automatically remove a value that is no longer valid.
Handle empty and unmatched categories
When no item matches the selected category, FILTER can return an error. You can display a blank instead:
=IFERROR(FILTER(Lists!B2:B, Lists!A2:A=Input!A2), "")A blank result means that the dependent drop-down has no useful choices. Check that the category spelling matches exactly. Extra spaces and different capitalization can cause unexpected results.
For a larger workbook, consider a normalized source table. Store one category-item pair per row, avoid blank rows inside the source range, and use consistent spelling. These choices reduce errors when the list grows.
Exercise
Input!A2 contains "Vegetables", but Input!B2 shows no choices. What should you check first?
Show answer
Check that the source rows use the exact same category text, that the FILTER formula references the correct sheet and columns, and that no value blocks the helper formula's spill range.