
Excel Data Validation: Dropdown Lists, Dependent Dropdowns, Dynamic Ranges, Error Messages, and Input Rules
This article is based on procedures personally reproduced and verified in Excel 365, with AI tools used only to assist with draft organization.
Prerequisite and related guides
1) Basic Dropdowns (Static and Dynamic)
Static List
- Data ▸ Data Validation ▸ Allow = List ▸ enter
Apple,Pear,Grape,Peachin Source
Dynamic List (Table + UNIQUE/SORT)
- Convert the source data to a table (CTRL+T): SalesTbl[Category]
- Enter
=SORT(UNIQUE(SalesTbl[Category]))in an empty range. - In Formulas ▸ Name Manager, create ddCategory and define it as follows:
=LET(x, SORT(UNIQUE(SalesTbl[Category])), FILTER(x, x<>"")) - For the target cell’s Data Validation, set Source to
=ddCategory.
TIP You can also directly reference a spill range with # notation, such as A1#. For more complex setups, use a defined name.
2) Dependent Dropdowns: Category to Item
- For the parent selection cell
E2, enter the following in the cell where the child list will be created:=LET(sel,$E$2, SORT(UNIQUE(FILTER(SalesTbl[Item], SalesTbl[Category]=sel)))) - Define the spill range above with the name ddItem.
- For the second dropdown’s Data Validation, set Source to
=ddItem.
It updates automatically even when the table structure changes. If needed, supplement labels with XLOOKUP.
3) Ten Custom Rules for Real-World Use
| Purpose | Type | Formula/Setting |
|---|---|---|
| Prevent duplicates | Custom | =COUNTIF($A:$A,A1)=1 |
| 6–12 characters | Custom | =AND(LEN(A1)>=6, LEN(A1)<=12) |
| Numbers only (hyphens allowed) | Custom | =SUM(--ISNUMBER(--TEXTSPLIT(A1,"-")))=COLUMNS(TEXTSPLIT(A1,"-")) |
| Basic email pattern | Custom | =AND(ISNUMBER(SEARCH("@",A1)), ISNUMBER(SEARCH(".",A1))) |
| Disallow weekend dates | Custom | =WEEKDAY(A1,2)<=5 |
| Past dates only | Date | Data = less than or equal to / End date = =TODAY() |
| Amounts in multiples of 1,000 | Custom | =MOD(A1,1000)=0 |
| Exclude prohibited words from text | Custom | =ISERROR(SEARCH("prohibited word",A1)) |
| Allow only values in a range | List | Internal list such as =ddCategory |
| Error-resistant input | Custom | =NOT(ISERROR(A1)) — in practice, use with IFERROR |
Learning string functions alongside the TEXTSPLIT/TEXTBEFORE/TEXTAFTER guide makes rule design much easier.
4) Input Message and Error Alert UX
- Input Message: Brief guidance when a user clicks a cell (for example, “Select a category first”).
- Error Alert: The styles are Stop, Warning, and Information. For training, use Information to encourage correction; for strict control, use Stop.
- Adding example values to messages greatly reduces mistakes.
5) Troubleshooting Checklist
- When #SPILL! occurs: Clear the spill range and unmerge merged cells. (Related: Dynamic Array Shaping Toolkit)
- Remove blank values: Clean up blanks in a list with
FILTER(x, x<>""). - Rules shift when copied: Use defined names or lock references with absolute references.
- Table column heading changes: Also update the formula referenced by the defined name.
- If the list is too long: Combine SEARCH/LEN to create a real-time filter helper cell that narrows the list before connecting it to validation.
6) Follow-Up Exercises and Template Ideas
Exercise A: Three-Level Dependent Dropdown for Region → Store → Staff
- Parent: Region (UNIQUE)
- Middle:
=SORT(UNIQUE(FILTER(Tbl[Store], Tbl[Region]=$E$2))) - Child:
=SORT(UNIQUE(FILTER(Tbl[Staff], (Tbl[Region]=$E$2)*(Tbl[Store]=$F$2))))
Exercise B: Combined “Format Validation + Dropdown” Rule
Use a dropdown to enforce default values, then use a Custom formula to validate length and patterns a second time.
Bookmark the finished version, then try turning the rules into templates with LAMBDA next month. (See LAMBDA/MAP/REDUCE.)