Search Contextures Sites ![]()
Excel Data Validation -- Create Dependent Lists
You can limit the choices in an Excel data validation list, by using named ranges and the INDIRECT function, to create dependent data validation lists. In this example, if Fruit is selected as the Category, only Fruit appears in the Item drop-down list.Another method is to use the OFFSET function, to extract items from a sorted list, as described here: Dependent Dropdowns from a Sorted List
Create Named Lists
Start by creating Named Lists, which will be the choices in the dependent data validation drop down lists. In this example, the first list will be named Produce.
It contains the Produce categories -- Fruit and Vegetable.
1. Create the first Named List
- In an empty area of the workbook, type the entries you want to see in the drop-down lists. These should be one-word entries, to match the dependent list names that will be created. If you need to use multiple word entries, see:
Using Two Word Items- Select the cells in the list (but not the heading).
- Click in the Name box, to the left of the formula bar
- Type a one-word name for the list, e.g. Produce.
- Press the Enter key.
2. Create the supporting Named Lists
- Type the entries you want to see in the Excel data validation drop-down list for one of the Produce categories.
- Select the cells in the list.
- Click in the Name box, to the left of the formula bar
- Type a one-word name for the list, e.g. Fruit. This name must be exactly the same as the matching entry in the Produce list.
- Press the Enter key.
- Create another list with the items for the next category -- Vegetable in this example.
Apply the Excel Data Validation
The cells in the Category column will allow a List.
The cells in the Item column will use the INDIRECT function to select a list.
1. Apply the Excel Data Validation
- Select the cells in which you want to apply Excel data validation using the Category List
- From the Data menu, choose Validation.
![]()
- From the Allow drop-down list, choose List
- In the Source box, type an equal sign and the list name, for example: =Produce
- Click OK.
![]()
2. Create the Dependent Data Validation
- Select the cells in which you want to apply dependent data validation using the Fruit or Vegetable List, dependent on which Category has been selected
- From the Data menu, choose Validation.
- From the Allow drop-down list, choose List
- In the Source box, type an equal sign and INDIRECT function, referring to the first data cell in the Category column: =INDIRECT(A2)
- Click OK.
Note: If cell A2 is empty, you'll see the message shown below. Click Yes to continue.
Watch the Dependent Data Validation Video
In this dependent data validation example, if a country is selected from the first drop down, only that country's cities appear in the next column's drop down list.
However, you can use the Excel IF function to make the selection more flexible. If no country is selected, the City column will show a list of world cities in the dependent drop down list.
Using Dynamic Lists
Because the INDIRECT function only works with references, not formulas, the previous method for dependent data validation won't work with dynamic lists. Instead, you can use the following method:
- Create the first named range and dropdown list as described above.
- Create the supporting named lists, and name the first cell in each range, e.g. cell B1 is named Fruit and cell C1 is named Vegetables.
- Name the column in which each list is located, e.g. column B is named FruitCol and column C is named VegetablesCol
- For the second dropdown, choose to Allow: List, and use a formula that calculates the lookup range. For example, if the first dropdown list is in cell E2:
=OFFSET(INDIRECT($E2),0,0,COUNTA(INDIRECT(E2&"Col")),1)
if two-word items will be used, you can include the SUBSTITUTE function in the formula:
Download a sample file for dependent data validation
with Dynamic Lists
=OFFSET(INDIRECT(SUBSTITUTE($F2," ","")),0,0,COUNTA(INDIRECT(SUBSTITUTE($F2," ","")&"Col")),1)
Download a sample file for Dynamic Lists Excel Tutorials - Data Validation
Contextures Inc., Copyright ©2012
All rights reserved.