Google Sheets Dependent Drop-Down: FILTER, Per-Row Lists and Stale Choices
To build a Google Sheets drop-down that changes with the first choice, I let FILTER write the matching options into a helper range, then give the second cell a Data > Data validation > Dropdown (from a range) rule that reads that range. For a single input row, the helper cell holds this formula:
=IF(B2="","",IFNA(FILTER(Catalogue!B2:B,Catalogue!A2:A=B2),""))
In a sheet with many rows, every row needs its own helper range, or Apps Script can set the rule row by row. Whichever route you take, the old value in the second cell stays when the first choice changes later; you count those rows with a check column.
I have not run the formulas or the script in a real Google file; I tested the logic on the fictional example below in Python, and every number comes from that test. Unverified points are listed under “What I could not verify” near the end.
Example: a 400-row service parts sheet
The company, machine models, part codes and all numbers below are fictional. At a compressor service company, the office logs parts used on site in an “Input” sheet: job number in column A (starting at IS-1001), machine model in B, part code in C, quantity in D. The sheet has 400 rows. The “Catalogue” sheet has the model in column A and the part code (such as VK37-05) in column B, with a header in row 1.
| Model | Options | Made up of |
|---|---|---|
| VK-15 | 9 | 6 model-specific + 3 shared parts |
| VK-22 | 11 | 8 + 3 |
| VK-37 | 8 | 5 + 3 |
| VK-55 | 14 | 11 + 3 |
| VK-75 | 12 | 9 + 3 |
The catalogue has 54 rows and 42 distinct part codes. UN-01, UN-02 and UN-03 (clamp, gasket, drain valve) are valid for every model and are listed on a separate row for each model, because FILTER only returns rows whose model matches exactly. Later, the model is corrected in 37 rows, leaving the selected part invalid in 29 of them and still valid (a shared part) in 8, and a 60-row field report is pasted in bulk; details in sections 1 and 5.
1. Building the second list with “Dropdown (from a range)”
The second list is tied to a cell range through Google’s Dropdown (from a range) criterion, and FILTER fills that range. Google’s data validation page describes the criterion as choosing the cells to include in the list.
- Model list. Select Input!B2, then Data > Data validation > Add rule. Choose Dropdown and type the five models. It rarely changes, so no separate range is needed.
- Helper range. Enter the formula above in Input!H2. FILTER spills the part codes for the model in B2 downwards from H2. According to Google’s FILTER page, the result is
#N/Awhen nothing matches, and IFNA turns that into an empty string. The IF at the front stops the formula from running while no model is selected; without it, an empty B2 can match the empty rows of the catalogue, since an empty cell equals an empty cell. An open-ended range such asCatalogue!B2:Bpicks up new catalogue rows without editing the formula. In locales that use semicolons, such as Turkish, the arguments are separated by;and some function names are localised (Google’s Turkish help calls IFNA “EĞERYOKSA”):=EĞER(B2="";"";EĞERYOKSA(FILTER(Catalogue!B2:B;Catalogue!A2:A=B2);"")). - Second list. Select Input!C2, Add rule again, criterion Dropdown (from a range), range
Input!H2:H15. The longest list belongs to VK-55 with 14 options, so the range is 14 cells long. - Invalid entries. Under Advanced options, do not pick Show a warning for “If the data is invalid:”. Google says entries that do not match the list are rejected unless that option is chosen, and accepted if it is. In the example, 60 rows from a field report were pasted while the rule was on Show a warning; 6 of them carried old-format part codes without the hyphen (such as VK2203) and got in for that reason. Those codes do not exist in the catalogue.
The length of the range is an easy-to-miss trap. When a 15th part is added for VK-55, FILTER writes 15 rows, but if C2 still reads H2:H15, the 15th part never shows up in the list. Extend the source range when the catalogue outgrows it.
2. How does the Excel INDIRECT approach translate to Google Sheets?
In Excel, a dependent list is usually built by defining a named range per category and typing =INDIRECT(B2) as the validation source of the second cell; the Excel dependent drop-down guide walks through it.
Google’s official data validation page does not say whether a formula can go into the “Dropdown (from a range)” box. Some tutorials show =INDIRECT(B2) working there; I have not tried it. Test it on a copy with two rows first.
I still make the FILTER helper range the main route, for two reasons. First, for INDIRECT to work across 400 rows, one rule on C2:C400 would have to follow each row’s own B cell, and Google does not document that relative behaviour; a helper formula sits in a cell where you can see what it calculates. Second, maintenance: INDIRECT needs a named range per model, while FILTER reads one catalogue table, so a new model is just new rows.
3. Giving every row its own list in a multi-row sheet
A single helper range serves only one input row: the FILTER in H2 looks at B2 alone, so the list in C3 does not follow B3. Since each of the 400 rows in the example can belong to a different model, there are three routes.
A horizontal helper per row. Write each row’s list sideways on its own row. This formula replaces the H2 formula from section 1:
=IF($B2="","",TRANSPOSE(IFNA(FILTER(Catalogue!$B$2:$B,Catalogue!$A$2:$A=$B2),"")))
TRANSPOSE turns the vertical result sideways. Fill the formula down H2:H400, set C2’s source to =$H2:$U2 and copy the rule down C3:C400 (copy C2, then Paste special > Data validation only; I did not verify the menu name in the interface). Whether the copied rule shifts its source row by row is not documented; on a copy, open the rule on a few rows and check the source.
The cost: the longest list is 14, so columns H to U, which across 400 rows is 5,600 helper cells. The growth trap applies here too: a 15th part for VK-55 spills into column V, and $H2:$U2 cannot see it.
Google Forms with section branching. If records are only ever added, make the model question a drop-down in Google Forms and give each model its own section. Google says “Go to section based on answer” works only with multiple choice and drop-down questions (Google Help). In the example that means a model question plus 5 sections. No helper cells are needed; the cost is that every catalogue change has to be made in the form by hand.
Apps Script, rule by rule. A script writes a fresh rule to the part cell whenever the model changes; see the next section.
4. Setting the rule row by row with an Apps Script onEdit trigger
Apps Script’s simple onEdit(e) trigger runs when a user changes a cell value. The script below takes every row whose model changed, pulls that model’s parts from the catalogue, writes a new rule to the part cell, and clears an old choice that is not valid for the new model, moving it into a note. To install it, open Extensions > Apps Script, paste the code and save; onEdit is a name Google reserves for simple triggers, so no separate trigger setup is needed. I have not run the script; test it on a copy with a few rows.
function onEdit(e) {
const sh = e.range.getSheet();
if (sh.getName() !== 'Input') return;
if (e.range.getColumn() > 2 || e.range.getLastColumn() < 2) return; // column B not touched
const first = Math.max(e.range.getRow(), 2);
const last = e.range.getLastRow();
if (last < first) return;
const cat = e.source.getSheetByName('Catalogue');
if (cat.getLastRow() < 2) return;
const catalogue = cat.getRange(2, 1, cat.getLastRow() - 1, 2).getValues();
const rows = sh.getRange(first, 2, last - first + 1, 2).getValues(); // B and C
rows.forEach(([model, old], i) => {
if (model === '') return; // model cleared: leave the part alone
const cell = sh.getRange(first + i, 3);
const list = catalogue.filter(k => k[0] !== '' && k[0] === model).map(k => k[1]);
if (!list.length) { cell.clearDataValidations(); return; }
cell.setDataValidation(SpreadsheetApp.newDataValidation()
.requireValueInList(list, true).setAllowInvalid(false).build());
if (old !== '' && !list.includes(old)) {
cell.setNote('Model changed, previous choice: ' + old);
cell.clearContent();
}
});
}
The script reads the whole edited range instead of e.value: Google’s event objects page says value and oldValue are only available when a single cell is edited. If a model cell is cleared, the script leaves the part alone. The Range and DataValidationBuilder methods it uses appear in Google’s Range and DataValidationBuilder references.
In the Python simulation, this logic cleared the part in 29 of the 37 corrected rows and left the 8 rows with a shared part alone. When IS-1008 is corrected from VK-37 to VK-55, for example, VK37-05 is cleared and moved into the note.
The script writes the current list into the rule itself. When a part is added to the catalogue, rows whose model has not changed keep the old list; refreshing them needs a separate function, which this example does not include.
Three of the simple trigger limits on Google’s triggers page matter for this script:
- It cannot run for longer than 30 seconds. The script writes a rule per row, so run time grows with the row count; I have not measured whether a bulk paste of 60 or 400 rows hits the limit.
- Changes made by scripts or API requests do not fire it. If another script or integration writes column B, this rule never runs.
onEditqueues at most 2 trigger events, so allow for an event going unprocessed during a burst of quick edits.
Because of the second and third points, the script does not tell you what it missed. That is why the check column in section 5 stays alongside it.
5. How to flag a part choice that went stale after a model change
When the first choice changes, the second cell keeps its value; a check column reading model and part together makes this countable. In the example, the model first reported from the field was wrong in 37 rows; the office corrected column B and left C alone, which left 29 stale choices.
Enter this in Input!E2 and fill it down:
=IF(C2="","",IF(COUNTIFS(Catalogue!$A$2:$A,B2,Catalogue!$B$2:$B,C2)>0,"","CHECK"))
The formula asks whether the row’s model and part appear together in the catalogue (Google Help, COUNTIFS). For the total, =COUNTIF(E2:E,"CHECK") is enough.
In the example this column flags 35 of the 400 rows (8.75 per cent): the 29 stale choices and the 6 hyphenless codes that do not exist in the catalogue. The 8 rows with a shared part are valid and stay unflagged, which is correct. The 29 stale choices account for 73 parts recorded against 14 different part codes; if stock is deducted from this sheet, those 14 balances are wrong.
Decide in writing who fixes a flagged row. The office should ask the technician, not guess; an automatic “nearest code” fix writes a new error over the old one.
6. Does pasting bypass data validation?
With Show a warning, values not on the list get in, as the six hyphenless codes did. Google does not say how pasting behaves under a reject rule. If your team pastes in bulk, test three rows on a copy (valid, stale, not in the catalogue); the check column remains the real safeguard, since it measures the result however the value arrived.
Which method, when?
| Method | When | Limit |
|---|---|---|
| One helper range + list from a range | A single input row or entry area | Serves one row only; the source range must grow with the longest list |
| Horizontal helper per row | A few hundred rows, no script wanted | 5,600 helper cells in the example; copying a relative source is not documented by Google |
| Forms + go to section | Records only added, few models | Catalogue changes made by hand; responses corrected in the sheet can still go stale |
| Apps Script onEdit | Rows are corrected later | 30 seconds, ignores script/API changes, 2-event queue; rules go stale when the catalogue changes |
| Check column (with all of the above) | Always | Flags rather than prevents; a person makes the fix |
7. Where a form or a web application starts to make sense
A sheet can enforce the model and part match at entry with a list, as the methods above do. The hard part is a value that went stale after the first choice changed: in a sheet that check happens after the record exists, and the check column covers it. Four questions decide the rest:
- Are records only added, or corrected later? If only added and the model count is small, section branching in Forms is enough. If records are corrected later, like the 37 model corrections in the example, use the sheet with Apps Script and a check column.
- Does the choice depend on another rule? A condition such as stock or customer-specific parts can be added to FILTER in the sheet too. Once the rule depends on several tables or users, setting it up and maintaining it gets harder.
- Can everyone see every row? Sharing in Sheets is granted per file; I found no row-level setting in Google’s help pages that would let technicians see only their own jobs.
- Are flagged rows cleared every week? The example produced 35 flags in 400 rows. If the weekly review brings them to zero, the sheet is doing its job; if not, the rule belongs at entry.
For the example company I recommend staying in the sheet: Apps Script setting the rule row by row, plus the check column. If question 2 or 3 becomes a yes, an application is worth considering. Such an application could cover: the part field emptying and asking for a new choice when the model changes, the model and part pair being checked again on the server at submission, only authorised people changing the catalogue, and a record of who changed which choice and when. The data stays yours, and you can export it to Excel or CSV at any time. The dependent dropdown custom forms page explains how such a form is designed.
If that is where you are heading, get in touch through the contact page.
What I could not verify
I checked the sources on 31 October 2026. I have not run the formulas or the script in a real Google file; the numbers come from the Python simulation. Points I found no source for or did not test:
- Whether a formula such as
=INDIRECT(B2)can go into the “Dropdown (from a range)” box. - Whether a copied rule shifts a relative source such as
=$H2:$U2row by row. - Whether the empty cells left in
Input!H2:H15show up as blank options in the list. - What happens to an invalid value pasted under a reject rule, and whether pasting fires
onEdit. - Whether the script hits the 30-second limit on a bulk paste.
- That an empty B2 matches empty catalogue rows: reasoning, not tested.
- Adding a stock or customer condition to FILTER: not tested.
- The Extensions > Apps Script menu path: not checked in the interface.
- That rejecting is the “default”: Google says entries are rejected unless Show a warning is chosen; calling it the default is my inference.
Frequently Asked Questions
Can I build a three-level list?
Yes; each level adds another helper range. Picture a separate sheet whose catalogue has region in A, city in B and district in C, with region in B, city in C and district in D on the input row. The district list’s FILTER takes two conditions: =IF(C2="","",IFNA(FILTER(Catalogue!C2:C,Catalogue!A2:A=B2,Catalogue!B2:B=C2),"")). Staleness chains too: changing the region makes both city and district stale. The check formula gets a third condition: COUNTIFS(Catalogue!A2:A,B2,Catalogue!B2:B,C2,Catalogue!C2:C,D2).
What happens to old records if a model is renamed in the catalogue?
The check column flags every old row entered with that model, because the old name no longer exists in the catalogue. Keeping the old name and adding new rows, or storing a fixed model code, avoids this.
Is hiding the helper columns enough?
It tidies the view, nothing more. Google’s protection page states that hiding a sheet is not the same as protecting it, and the same reasoning appears to apply to hidden columns. If nobody should type into the helper columns, protect the range. The same page warns that protection is not a security measure: it limits editing, not viewing.
