Search Contextures Sites

Excel Data Validation -- Create Dependent Lists

Create Named Lists
Apply the Excel Data Validation
Test the Excel Data Validation
Watch the Dependent Data Validation Video

Adding a Third Dependent List
Using Two-Word Items
Using Items with Illegal Characters
Using Dynamic Lists

 

Download a sample file for dependent data validation

 

   


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

Dependent drop-down
   

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

  1. 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
  2. Select the cells in the list (but not the heading).
  3. Click in the Name box, to the left of the formula bar
  4. Type a one-word name for the list, e.g. Produce.
  5. Press the Enter key.

 

First named range

2. Create the supporting Named Lists

  1. Type the entries you want to see in the Excel data validation drop-down list for one of the Produce categories.
  2. Select the cells in the list.
  3. Click in the Name box, to the left of the formula bar
  4. 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.
  5. Press the Enter key.
Second named range

 

  1. Create another list with the items for the next category -- Vegetable in this example.

Third named range

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

  1. Select the cells in which you want to apply Excel data validation using the Category List
  2. From the Data menu, choose Validation.

    Data menu
 
   
  1. From the Allow drop-down list, choose List
  2. In the Source box, type an equal sign and the list name, for example: =Produce
  3. Click OK.

 


Data Validation source

2. Create the Dependent Data Validation

  1. 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
  2. From the Data menu, choose Validation.
  3. From the Allow drop-down list, choose List
  4. In the Source box, type an equal sign and INDIRECT function, referring to the first data cell in the Category column: =INDIRECT(A2)
  5. Click OK.

Indirect formula as source

Note: If cell A2 is empty, you'll see the message shown below. Click Yes to continue.

Source error message

 

 

   

Test the Dependent Data Validation

  1. Click on a cell in the Category column, and select either Fruit or Vegetable, from the Produce drop down list.
  2. Press the Tab key on your keyboard, to move to the Item column, in the same row.
  3. In the Item column, click the drop down arrow, and select an item. The drop down list shows either Fruit or Vegetable items, depending which has been selected in the Category column

NOTE: If a Category has not been selected, the Item drop down in that row will not work.

 

 
Data validation test

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.

Adding a Third Dependent List

You could add another set of dependent data validation dropdown lists that depend on the selections in the first two dropdowns. For example, select a country and region, then select a city in that region.

 

 

  1. Create the two named ranges and dropdown lists as described above.
  2. Create another set of named ranges, naming them for the available combinations in the first two Excel data validation drop-downs. For example, you might create ranges named CanadaOntario and USANewYork.
  3. For the third dropdown, choose to Allow: List, and use a formula that combines the entries in the first two columns, and removes the spaces from the names. For example, in cell D2, the data validation formula would be:

  =INDIRECT(SUBSTITUTE(B2&C2," ",""))

 

Using Two-Word Items

You may need to have two-word items in the first Excel data validation drop-down list. For example, your choices are 'Red Fruit', 'Green Fruit' and 'Yellow Fruit'

  1. Create the first named range and dropdown list as described above.
  2. Create the supporting named lists, using one-word names, e.g. RedFruit, GreenFruit, YellowFruit
  3. For the second dropdown, choose to Allow: List, and use a formula that removes the spaces from the names. For example:

  =INDIRECT(SUBSTITUTE(A2," ",""))

 

Dependent two word lists

Using Items with Illegal Characters

You may need items in the first Excel data validation drop-down list that contain characters not allowed in range names, such as the ampersand (&).

For example, your choices are 'Red Fruit', 'Green Fruit' and 'Yellow & Orange Fruit'. For the dependent lists, you can create ranges with one-word names, such as YOFruit. Then, you can create a lookup table, which lists each item in the first Excel data validation drop-down list, and the range where its dependent items will be stored.

To start, create the item lists and the first Excel data validation drop-down:

  1. Create the first named range and drop-down list as described above. In this example, the range is named FruitList, with values in cells A6:A8. The drop-down list in cell A2 uses FruitList as its source.
  2. Create the dependent lists, and name them, using one-word names, e.g. RedFruit, GreenFruit, YOFruit. In this example, RedFruit is in A11:A12, YOFruit is in B11:B12 and GreenFruit is in C11:C12.
  3. Select an item from the drop-down list in cell A2.

Next, you'll create the lookup table, to match each item with its dependent items' range name.

  1. In the column to the right of the FruitList range, enter the range name for each item's dependent list. For example, YOFruit is entered as the dependent range name for Yellow & Orange Fruit.
  2. Name the lookup table. In this example, the range A6:B8 is named NameLookup.
  3. Select cell B2, and from the Data menu, choose Validation.
  4. Choose to Allow: List.
  5. For the Source, enter a formula that uses a VLookup formula to find the dependent list's range name.
    For example:   =INDIRECT(VLOOKUP(A2,NameLookup,2,0))

With Green Fruit selected in cell A2, the VLookup formula will return GreenFruit as the range name for the dependent list. The GreenFruit list will be displayed in cell B2's drop-down.

 

Dependent illegal characters

Illegal characters formula

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:

  1. Create the first named range and dropdown list as described above.
  2. 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.
  3. Name the column in which each list is located, e.g. column B is named FruitCol and column C is named VegetablesCol
  4. 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

Dependent 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

   

Data Validation Basics
Data Validation - Create Dependent Lists
Data Validation - Dependent Dropdowns from a Sorted List  
Data Validation - Dependent Lists With INDEX  
Hide Previously Used Items in a Dropdown List
Data Validation - Display Messages to the User
Data Validation - Display Input Messages in a Text Box 
Data Validation - Use a List from Another Workbook
Data Validation Criteria Examples
Data Validation Custom Criteria Examples
Data Validation Tips
Data Validation Documentation
Data Validation Combo Box     
Data Validation Combo Box - Named Ranges
Data Validation Combo Box -- Click
Data Validation - Add New Items  

Learn how to create Excel dashboards.

 

       Home     Excel Tips     Excel Files     The Excel Store     Blog     Contact

 

Privacy Policy

 

Contextures Inc., Copyright ©2012
All rights reserved.