OĞUZ EROLAI·ADS·APPS

Excel Dependent Drop-Down List: INDIRECT, FILTER and Stale Selections

14 min readPublished: Updated:

An Excel dependent drop-down list narrows the choices in a second cell based on the first: pick a machine in column B and column C offers only that machine’s spare parts. There are three ways to build it. In any version, name each machine’s part list and use =INDIRECT(B2) as the data validation source for the second cell. In a multi-row table, without a volatile function, cut the part range out of a sorted table with INDEX:INDEX. In a single-row entry form on Microsoft 365, generate the list with FILTER. Whichever you choose, Excel leaves the old second-level value in place when the first changes, and it does not validate pasted data. A check column closes both gaps.

Source note: I wrote the formulas from Microsoft’s documentation without running them in Excel; test them on a few rows first. Nor have I tried =Helper!$A$2# or =Machines[Machine] as validation sources. Version lists and product behaviour here (VBA on the web, tables and spills, alert styles, pasting) come from Microsoft pages read on 31 October 2026 and may change.

Example: 6 machines, 45 part rows, 360 request rows

The workshop, machines, codes and figures below are fictional; a Python script calculated and checked the numbers.

A metalworking shop’s maintenance team logs spare-part requests in one workbook. Six machines: CNC Lathe, Vertical Mill, Press Brake, Guillotine Shear, Laser Cutter and Compressor. The part catalogue has one row per machine-part pairing, 45 rows in total; three parts fit two machines each. On the Requests sheet, A is the date, B the machine, C the part and D the quantity. Technicians enter 360 request rows in one period; purchasing turns them into orders. B and C use a dependent drop-down with the alert set to Stop.

No invalid value was typed in; the Stop alert blocked that. The errors came another way:

eventnumber of rowsleft invalidordered
Previous row copied, only the machine changed413728
Copy-paste from another workbook1871
Total (out of 360 rows)5944 (12.2%)29 (8.1%)

In the table’s first event, 41 rows, a technician copied the row above and changed only the machine; the part stayed. In 4 rows the part was shared and still valid for the new machine, while 37 rows kept a stale selection: machine “Press Brake”, part belonging to the CNC Lathe. Of the 18 pasted rows, 7 were wrong: 5 old codes no longer in the catalogue and 2 valid codes against the wrong machine.

Purchasing caught 15 of the 44 by phone, including all 5 missing codes. The remaining 29 rows became wrong orders, and 28 came from stale selections. A dependent list alone did not keep rows correct.

Which method when?

methodwhenlimit
1. Define Name + INDIRECTAny version; few, stable categoriesNaming rules, volatility
2. FILTER + #Microsoft 365; single-row entry formDoes not fit a multi-row table
3. INDEX:INDEXAny version; multi-row table, long catalogueTable must stay sorted by machine
Form or web applicationRule enforced at save time, many users and rolesNeeds building and maintenance

Multi-row table or mixed Excel versions: Method 3. Few, stable categories: Method 1. Single-row entry form on Microsoft 365: Method 2. For the example workshop I would use Method 3 plus the check column. No method alone prevents the 29 wrong orders.

Method 1 needs a wide layout: a PartsWide sheet with one column per machine. Methods 2 and 3 need a long layout: a two-column Parts table with one row per pairing. In all three methods column B uses the name MachineList as its source; only the definition of that name changes.

Method 1: Define Name and INDIRECT (any version)

INDIRECT turns the machine name in B2 into a reference to the range with that name, so each part list needs a name.

  1. On PartsWide, put each machine’s parts in a separate column, with the machine names in row 1 (A1:F1).
  2. Select one machine’s parts (without the header) and use Formulas > Define Name. The name is the machine name adjusted to the naming rules: CNC_Lathe, Laser_Cutter. Repeat for all six columns.
  3. In Name Manager (Ctrl+F3), define MachineList as =PartsWide!$A$1:$F$1.
  4. Select Requests!B2:B1000, open Data > Data Validation > Allow: List and set the source to =MachineList.
  5. Select Requests!C2:C1000 with C2 as the active cell and enter =INDIRECT(SUBSTITUTE($B2," ","_")) as the source. $B2 is a relative row reference, so the rule in C500 looks at B500. SUBSTITUTE swaps the space in the machine name for an underscore.
  6. On the Error Alert tab, keep the style at Stop. Warning asks Yes or No and can let a value outside the list through (data validation).

See the INDIRECT page; function names and separators differ in localised Excel.

Naming rules: 5 of the 6 machine names fail because of spaces

Microsoft’s names in formulas page sets the rules: the first character is a letter, an underscore or a backslash; the rest can only be letters, numbers, periods and underscores. No spaces, no name identical to a cell reference such as Z$100 or R1C1, up to 255 characters, and case is ignored. Five traps follow:

  • Spaces: “CNC Lathe”, “Vertical Mill”, “Press Brake”, “Guillotine Shear” and “Laser Cutter” cannot be names; only “Compressor” can. That is why the source uses SUBSTITUTE.
  • Hyphens: a part code such as “HF-10” cannot be a name. If you add a third level (part to size), the second-level values become names too, so swap hyphens for underscores.
  • Cell addresses: it is tempting to key machines by codes such as CNC1, VMC2, PRB1, GLT1, LSR1 and CMP1. All six are valid cell addresses, because Excel’s columns run to XFD, column 16,384. LSR1 is row 1 of column LSR and will not be accepted; prefix such codes with an underscore.
  • Accented letters: the rule says “letter”; I have not tested names containing letters such as ö or İ. Define one in Name Manager and check.
  • Trailing spaces: a source value such as “Laser Cutter ” looks for Laser_Cutter_ and the list opens empty. Clean the machine list.

Two limits of INDIRECT: volatility and closed workbooks

INDIRECT is a volatile function: cells containing it are re-evaluated with their dependents at every recalculation, and it calculates single-threaded (Excel Recalculation, performance tips). I found nothing on formulas inside validation rules; in my reading the cost shows up in worksheet formulas such as a 360-row check column, so the check column below avoids INDIRECT.

The second limit: INDIRECT pointing at another workbook needs that workbook open, otherwise it returns #REF!. Keep the catalogue inside the request workbook, not in a separate catalogue.xlsx.

Preparing Methods 2 and 3: the Parts table (Ctrl+T)

Turn the long part list into an Excel table so drop-downs based on it pick up new rows; Microsoft’s drop-down guide recommends this. Select a cell in the range and press Ctrl+T.

Name the table Parts, with columns Machine and Part. Define two names in Name Manager: PrtMachine = =Parts[Machine] and PrtCode = =Parts[Part]. Names in structured references adjust as data is added or removed (structured references), so both names grow with the table. The check column uses them too.

Method 2: FILTER, UNIQUE, SORT and # (single-row entry form)

This route suits a single entry area: on an Entry sheet, B2 is the machine and C2 the part; in the 360-row table it cannot give each row its own list. Microsoft’s support list for FILTER, UNIQUE and SORT shows Microsoft 365, Excel 2024 and Excel 2021 (FILTER). The page for the spilled range operator (#), which this method relies on, lists only Microsoft 365; I have not tried # in 2021 or 2024.

  1. On a Helper sheet, enter =SORT(UNIQUE(Parts[Machine])) in A2; the list spills down.
  2. Define MachineList as =Helper!$A$2# and use it as the source for Entry!B2; a name keeps the source in one place.
  3. In Helper!C2, enter =FILTER(Parts[Part],Parts[Machine]=Entry!B2,""). The third argument avoids an error while no machine is chosen. Define PartList as =Helper!$C$2# and use it as the source for Entry!C2.

The spilled range operator makes a reference grow and shrink with the spilled result. Spilled formulas are not supported inside Excel tables (spill errors), so put helper formulas outside the table, in empty cells, and do not hand over a list while a #SPILL! error remains.

Method 3: INDEX:INDEX (multi-row table, any version)

If the Parts table is sorted by machine, with each machine’s rows together, the second list’s source can be the range between that machine’s first and last part rows. For column B, create a one-column Machines table (column Machine), define MachineList as =Machines[Machine] and use =MachineList as the source for Requests!B2:B1000. For Requests!C2:C1000, with C2 active, the source is:

=INDEX(PrtCode,MATCH($B2,PrtMachine,0)):INDEX(PrtCode,MATCH($B2,PrtMachine,0)+COUNTIF(PrtMachine,$B2)-1)

MATCH finds the first row, COUNTIF counts the parts, and : joins the two INDEX results into one range. INDEX returns a reference and is not volatile (calculation performance). Spaces in machine names do not matter; no per-machine names are needed.

The one condition is the sort order. For all 6 machines the script’s ranges matched the catalogue exactly, but when a new CNC Lathe part (CT-09) is added at the bottom of the table, the CNC Lathe list stretches to 10 rows: the new part is missing and the Vertical Mill’s first part, DI-01, appears instead. After adding rows, re-sort by machine with Data > Sort, or insert the new part among its machine’s rows.

Stale second-level choices: how to catch them

Excel neither clears nor flags the old part. The data validation documentation says no message appears when a change in a referenced cell makes a validated value invalid, and Excel does not flag existing invalid data on its own.

1. Check column (required). Enter this in E2 and fill down:

=IF(AND(B2="",C2=""),"",IF(COUNTIFS(PrtMachine,B2,PrtCode,C2)=0,"INVALID",""))

It writes “INVALID” when the pair is not in Parts. COUNTIFS treats a criterion pointing at an empty cell as 0 (COUNTIFS), so a row with a machine but no part is flagged, as is a part with no machine; a fully empty row is not. It works with any method. In the example it flags all 44 invalid rows: 37 stale selections and 7 pasted ones.

For a visual cue, select A2:D1000, open Home > Conditional Formatting > New Rule > Use a formula to determine which cells to format and enter =AND(OR($B2<>"",$C2<>""),COUNTIFS(PrtMachine,$B2,PrtCode,$C2)=0). A normal paste carries formatting, so I expect the rule may be lost in pasted cells. Keep the check column outside the paste area and give purchasing one rule: a row with anything in column E is not ordered. In the example that rule would have brought the 29 wrong orders down to zero.

2. Circle Invalid Data. Found under the arrow on Data > Data Tools > Data Validation, it circles cells that break their rule. In my reading it only checks cells that still have a rule: in the example it catches the 37 stale selections and misses the 7 invalid pasted rows, because pasting removed their rule (see the next section).

3. VBA that clears the part when the machine changes (optional). Paste it into the Requests sheet’s code module (right-click the sheet tab > View Code):

Private Sub Worksheet_Change(ByVal Target As Range)
    Dim changed As Range, cell As Range
    Set changed = Intersect(Target, Me.Range("B2:B1000"))
    If changed Is Nothing Then Exit Sub
    On Error GoTo Done
    Application.EnableEvents = False
    For Each cell In changed.Cells
        ' Clear the part only if it was not part of the same change (machine changed alone)
        If Intersect(cell.Offset(0, 1), Target) Is Nothing Then
            cell.Offset(0, 1).ClearContents
        End If
    Next cell
Done:
    Application.EnableEvents = True
End Sub

What it does: clears the part when the machine changes on its own. In the example it clears all 41 rows, 4 of them unnecessarily (a valid shared part). What it cannot do: when B and C are pasted together it does nothing, so the 7 invalid pasted rows stay. It needs an .xlsm file, and VBA cannot run in Excel for the web. For sharing and maintenance, see the Excel macro and VBA guide.

Copy-paste skips data validation

Data validation only checks values typed into a cell; when data is copied or filled, no message appears (data validation). A default paste also brings everything from the source cell, validation included (paste options), so pasting from a workbook without rules removes the list from the target cells. In the example, 7 of the 18 pasted rows were wrong and none triggered a warning. Besides the check column, two precautions:

  • Paste Special > Values. It pastes values only; the cell keeps its own rule, but the pasted value is still not checked.
  • Bulk rows from another workbook go to a separate sheet first and move in after the check.

When the list is part of a multi-user process: where a form or web application starts

In Excel, a dependent list and a check column flag the error but do not stop the record. Ask four questions:

  1. Must an invalid row be stopped before it is saved? The check column flags it afterwards; purchasing looking at column E is a human step.
  2. Does anyone enter data from a browser or a phone? The VBA that clears stale selections does not run in Excel for the web, so that rule does not apply to them.
  3. Do you need roles at row level? Technicians enter, the maintenance lead edits the catalogue, purchasing approves, and approved rows stay fixed. Cell protection cannot do this row by row.
  4. Must old requests stay correct when a catalogue name changes? Excel stores machine and part as text, so renaming turns old rows “INVALID”, and with INDIRECT the name has to be redefined as well.

No “yes” answers: stay in Excel with Method 3, the check column and the no-order rule; VBA is an optional extra. One or two: you can stay in Excel, but those points rely on people checking; if a single missed row is expensive, consider a form with dependent choices. Three or four: the rules and roles exceed what a workbook can carry; a form or web application fits better.

For the example workshop, an application could be built to do the following: the part field clears when the machine changes and the record cannot be saved without a fresh choice; the server re-checks the pairing on save; bulk rows from another file pass the same check, with invalid ones listed row by row; only the maintenance lead manages the catalogue and only purchasing approves. I cover form design on the dependent dropdown custom forms page and moving a whole spreadsheet in turning Excel into a web app.

If an application is built, it runs on a virtual private server (VPS) that can be set up under your company’s account. The data is yours, and you can export it to Excel or CSV at any time. For small and medium-sized teams there is no per-user licence; the cost is the server and maintenance. The source code sits in a repository you can access, with run instructions, a dependency list and known limitations.

Send your request workbook through the contact page, with part and supplier names masked and a note on who fills in which column.

Frequently Asked Questions

How does the list grow when I add a part or a machine?

In Method 1 a name covers a fixed range, so a part added below it does not appear: extend the name in Name Manager (Ctrl+F3), and for a new machine define a new name and widen MachineList. In Method 2, adding rows to Parts is enough, since the machine list comes from it; in Method 3, add rows to Parts and Machines and the names grow with them; in Method 3, re-sort the table by machine afterwards.

Does Excel complain if B2 is empty when I set up the rule?

It may. With B2 empty, INDIRECT and MATCH return an error, and Excel may warn that the source evaluates to an error. I have not seen this message; pick a machine in B2 first, then create the rule.

Can I build a three-level list (machine → part group → part)?

Yes. With INDIRECT, every machine-group combination needs its own name (such as CNC_Lathe_Hydraulic), and the number of names grows fast. For a single-row entry in Microsoft 365, FILTER takes two conditions: =FILTER(Parts[Part],(Parts[Machine]=B2)*(Parts[Group]=C2),""). In a multi-row table, use Method 3 with the table sorted by machine and group, keeping the machine-group combination in one helper column. The check column should then test all three columns.

Back to top ↑