Excel course · Lesson 12 of 34

Data validation: drop-down lists and dependent lists

Stop bad data at the door: whole number, date and length rules, drop-down lists from tables, dependent drop-downs, input messages and error alerts.

Beginner 16 min read

Data validation controls what can be typed into a cell. It is the cheapest way to keep a shared workbook clean: instead of fixing Nrth, north and North after the fact, you give people a drop-down list. Instead of a quantity of -5 or ten, you allow only whole numbers from 1 to 500. This lesson covers the rule types, drop-down lists that grow automatically, dependent (cascading) lists, and the limits of validation.

Your first rule: whole numbers only

  1. Select the cells that will hold quantities, for example D2:D100.
  2. Choose Data › Data Tools › Data Validation (on Windows also Alt, A, V, V).
  3. On the Settings tab set Allow: Whole number, Data: between, Minimum: 1, Maximum: 500.
  4. On the Input Message tab type a title Quantity and the message Enter a whole number from 1 to 500. This appears as a small note when the cell is selected.
  5. On the Error Alert tab choose Style: Stop, title Invalid quantity, and a message explaining what is allowed.
  6. Click OK. Try typing 0, 12.5 or ten: Excel refuses each one.

Validation types

AllowUse it forExample setting
Whole numberQuantities, ages, yearsbetween 1 and 500
DecimalPrices, ratesbetween 0 and 1 for a percentage
ListFixed choicesSource: North,South,East,West
DateOrder or due datesgreater than or equal to =TODAY()
TimeShift start timesbetween 06:00 and 22:00
Text lengthCodes, postcodesequal to 5
CustomAnything a formula can test=COUNTIF($A:$A,A2)=1 (no duplicates)

Minimum and maximum can be cell references or formulas, for example a date that must be after the order date in column B: Date, greater than or equal to, Start date =B2.

A short fixed list

  1. Select the Region column cells.
  2. Open Data › Data Validation, set Allow: List.
  3. In Source type North,South,East,West (use semicolons if your regional settings use them as list separators).
  4. Keep In-cell dropdown ticked and click OK. Each cell now has an arrow; pressing Alt+Down Arrow (Mac: Option+Down Arrow) opens the list from the keyboard.

A list from cells that grows automatically

Typed lists are hard to maintain. Better: keep the items on a separate sheet, in an Excel table, and point the validation to it.

A
1Products
2Laptop
3Monitor
4Keyboard
5Mouse
6Headset

On a sheet called Lists, a one-column table named tblProducts.

  1. On a sheet called Lists, type the products, click inside and press Ctrl+T to make a table. Name it tblProducts in Table Design › Table Name.
  2. Validation cannot refer to a table column directly, so create a name: Formulas › Define Name, Name ProductList, Refers to =tblProducts[Products].
  3. Select the input cells on your order sheet and open Data › Data Validation, Allow: List, Source: =ProductList.
  4. Add Webcam at the bottom of the table. It appears in every drop-down immediately.
Tip. In Excel 2010 and later you can also enter a source on another sheet directly (=Lists!$A$2:$A$6), but that fixed range does not grow. The name-over-table method does. In Microsoft 365 a third option is a spilled range, for example =Lists!$C$2# where C2 holds =SORT(UNIQUE(...)).

Dependent (cascading) drop-down lists

A dependent list changes its choices based on another cell: pick a category in column A, and column B only offers products from that category.

DEF
1HardwareSoftwareServices
2LaptopOffice suiteInstallation
3MonitorAntivirusTraining
4PrinterAccountingSupport plan

On the Lists sheet: one column per category, the header is the category name.

Method 1: INDIRECT with names (all versions)

  1. Select D1:F4 and choose Formulas › Defined Names › Create from Selection, tick Top row only. This creates the names Hardware, Software and Services, each pointing to its column of items.
  2. Create the first list: select the Category cells (say A2:A50 on the order sheet), Data Validation › List, Source =Lists!$D$1:$F$1.
  3. Create the dependent list: select B2:B50, Data Validation › List, Source =INDIRECT(A2). Excel may warn that the source currently evaluates to an error because A2 is empty; click Yes to continue.
  4. Pick Software in A2. The drop-down in B2 now shows Office suite, Antivirus and Accounting.

INDIRECT turns the text in A2, such as Software, into a reference to the range with that name. Because the reference to A2 is relative, row 3 uses A3, row 4 uses A4, and so on. Category names must be valid names, so Office Supplies must become Office_Supplies (use =INDIRECT(SUBSTITUTE(A2," ","_")) if your categories contain spaces).

Method 2: FILTER on a two-column list (Microsoft 365)

With dynamic arrays you can keep all items in one long two-column table (Category, Item), which is easier to maintain. In a helper cell, say H2 on the Lists sheet, write =FILTER(tblItems[Item], tblItems[Category]=Orders!A2) and use =Lists!$H$2# as the validation source. The limitation is that the helper formula refers to one specific row, so this works best for a single input form rather than a long list of rows.

Watch out. If a user changes the category after choosing an item, the old item stays in column B even though it no longer belongs to the category. Add a conditional formatting rule or a check column like =COUNTIF(INDIRECT(A2),B2)=0 to flag mismatches.

Error alert styles

StyleWhat happens with invalid input
StopThe entry is refused. The user must retry or cancel.
WarningThe user is asked 'Continue?' and may accept the value.
InformationA message appears but the value is accepted.

Limits of data validation

  • Validation checks only typed entries. Pasting over a validated cell replaces the rule along with the value, and invalid data gets in.
  • Values that existed before the rule was created are not checked. Use Data › Data Validation › Circle Invalid Data to find them, and Clear Validation Circles to remove the marks.
  • Formulas in validated cells are not validated.
  • A list typed directly in the Source box is limited to 255 characters.
  • To protect against pasting, combine validation with sheet protection (Protecting sheets and workbooks).

Finding and copying validation

  • Home › Find & Select › Data Validation selects every validated cell on the sheet.
  • To copy just the rule, copy a cell and use Paste Special › Validation.
  • To remove rules, select cells, open Data Validation and click Clear All.
  • Tick Apply these changes to all other cells with the same settings when editing a rule to update every copy at once.
Note. Data validation works the same in Excel 2016 to Microsoft 365, on Mac and on the web. Microsoft 365 adds search inside long drop-down lists (type to narrow the list) and allows spilled ranges as sources. Excel for the web can create list, number, date and custom rules.

Check yourself

1. Which validation type creates a drop-down?

2. Why point a drop-down to a name that refers to a table column?

3. In a dependent list, the source is =INDIRECT(A2). What must exist?

4. Which alert style lets the user keep an invalid value after a warning?

5. A user pastes text into a cell that only allows whole numbers. What happens?