Contextures

Dependent Drop Down - Dynamic Arrays

Limit the choices in one Excel drop down list, based on the value in another cell. This example uses dynamic arrays and spilling to create the lists used in the drop downs. Select a region name, and then select an employee from that region.

NOTE: For earlier versions of Excel, without dynamic arrays, use other techniques for setting up dependent drop down lists.

Dependent Drop Down Lists

This video shows how to set up dependent drop down lists, based on dynamic arrays that have the items for each list. There are written instructions below the video.

Worksheet Setup

On the Data Enrry sheet, there is a list with region and employee names. This list was formatted as an Excel Table. If names are added or removed, the list size will adjust automatically.

list formatted as Excel table

Data entry cells are set up at the top of the sheet, where you'll choose a region, and then you'll select an employee from that region.

For now, just the headings, fill colour and borders have been added

cells for drop down lists

After everything is set up, those cells will have drop down lists, as you can see in this animated screen shot.

Dependent drop-down

Dynamic Unique List

We want to create a drop down list of region names i cell F2. To get those region names, follow these steps to create a dynamic list of the unique region names

  • In cell D6, type a heading fot the list -- Reg
  • In cell D7, type this formula, to create a dynamic array with the region names:
    • =UNIQUE(A2:A11)
  • Press Enter, to see the list of region names -- Excel uses Spilling to create a dynamic list that will adjust in size automatically.

NOTE: When you create a dynamic array, try to leave enough empty rows below the formula cell, and empty columns to the right (if needed). If there's not enough room, Excel will show a #SPILL error, instead of the list

formula creates a unique list

Sort the List

In some drop down list, the items will be easier to find if they're sorted alphabetically. Follow these steps to sort the list of region names.

  • Select cell D7, where the dynamic array formula was entered.
  • Click after the equal sign, and type: SORT(
  • Click after the closing bracket, and type another closing bracket: )
  • The revised formula is: =SORT(UNIQUE(A2:A11))
  • Press the Enter key, and the list sorts automatically, A-Z

formula sorts the unique list

Make the First Drop Down

Next, follow these steps to make a drop down list of region names, in cell F2

  • Select cell F2
  • On the Ribbon, click the Data tab, then click Data Validation.
  • From the Allow drop-down list, choose List
  • In the Source box, type an equal sign
  • Next, click on cell D7, where the region list formula was entered
  • Finally, type a number sign -- #. That's the spilled range operator, which tells Excel to use the entire spilled array range
  • The completed formula in the Source box is: =$D$7#
  • Then, click OK, to complete the data validation set up.

formula sorts the unique list

Test the Drop Down List

To test the drop down list of Region names:

  • Select cell F2
  • Click the drop down arrow
  • Select a region name from the drop down list.

select a region name from drop down list

Create an Employee List

In cell G2, we want a drop down list of employees. Instead of showing all the names, we'd only like to see the employees from the region that was selected in cell F2.

To create this dependent drop down list, we'll build another dynamic array formula, using the FILTER function.

  • In the first argument, we'll tell Excel where the source list is.
  • In the second argument, we'll tell Excel that the region name in column A must match the selected region name in cell F2

Follow these steps to create the formula:

  • In cell F6 and F7, type 2 headings fot the list -- Reg and Emp
  • In cell F7, type this formula, to create a dynamic array with the employee names for the selected region:
    • =FILTER(A2:B11,A2:A11=F2)
  • Press Enter, to see the list of employee names for the selected region. Excel uses Spilling to create a dynamic list that will adjust in size automatically.

list of employees for selected region

To test the dynamic list, select a different region name in cell F2. The list of employee names changes automatically. Here's the list after the East region was selected, with only 2 employee names showing.

list of employees for selected region

Sort the Employee Names

Just like we did with the region name list, we'll use the SORT function in this list, to put the employee names in alphabetical order. Because this list has 2 columns, we'll type a 2 as the second argument, to tell Excel to sort by the 2nd column.

Follow these steps to sort the employee names.

  • Select cell F7, where the dynamic array formula was entered.
  • Click after the equal sign, and type: SORT(
  • Click after the closing bracket, and type a comma
  • Type a 2, for the sort index number, then type a closing bracket: )
  • The revised formula is:
    • =SORT(FILTER(A2:B11,A2:A11=F2),2)
  • Press the Enter key, and the employee names are sorted automatically, A-Z

employee names sorted alphabetically

Dependent Drop Down List

Next, we'll use data validation to create a drop down list of employee names. This is a dependent drop down list -- its contents depend on what region was selected in cell F2.

Because the employee names are in a 2-column list, we'll use the INDEX function to return the names from the 2nd column. In the INDEX function,

  • The 1st argument is the the dynamic range that starts in F7
  • The 2nd argument (row) will be left empty
  • The 3rd argument (column) will be 2

Follow these steps to make a drop down list of employee names, in cell G2

  • Select cell G2
  • On the Ribbon, click the Data tab, then click Data Validation.
  • From the Allow drop-down list, choose List
  • In the Source box, type: =INDEX(
  • Next, click on cell F7, where the region employees list formula was entered
  • Then type the spilled range operator: #
  • Type 2 commas -- ,,
  • Type a 2 and the closing bracket -- 2)
  • The completed formula in the Source box is: =INDEX($F$7#,,2)
  • Finally, click OK, to complete the data validation set up.

formula sorts the unique list

Test the Drop Down List

To test the drop down list of employee names:

  • Select cell G2
  • Click the drop down arrow, and select an employee name
    • The employee list in the drop down should be the same as the list in the dynamic range

test the employee down list

  • Clear cells F2 and G2, then choose a different region
  • The drop down in cell G2 should show different names, based on the region that you selected.

test with a different region name

Fix the Error

When cell F2 is empty, cell F2 shows a #CALC! error, because there's no region for the filter.

IFERROR shows a message

If you'd rather not see that error, use the IFERROR function to show an empty cell, or show a message.

For example, change the formula in cell F7 to the following:

=IFERROR(SORT(FILTER(A2:B11, A2:A11=F2),2), "Select a region")

The message, "Select a region", will show, instead of the #CALC! error.

error when no region is selected

Download the Sample File

  1. Download the completed Dependent Drop Downs - Dynamic Arrays sample file, to see how this technique works. The zipped file is in xlsx format, and does not contain any macros. For versions of Excel that support dynamic arrays.

Don't Miss Our Excel Tips

Don't miss my latest Excel tips and videos! Click OK, to get my weekly newsletter with Excel tips, and links to other Excel news and resources.

Get weekly Excel tips from Debra

More Tutorials

Data Validation Basics

Dependent Drop Down Setup Choices

Dependent Drop Down Lists Video

Dependent Dropdowns from a Sorted List

Dependent Lists With INDEX

Hide Previously Used Items in a Dropdown List

Use a Data Validation List from Another Workbook

Data Validation Criteria Examples

Data Validation Tips

Data Validation With Combo Box

 

 

 

 

Excel Data Entry Popup List

 

 

Get weekly Excel tips from Debra

 

 

Excel Tools add-in

 

 

Excel Data Entry Popup List

 

 

 

 

Excel Data Entry Popup List

 

 

 

Excel Data Entry Popup List

 

 

 

 

 

 

 

 

 

 

 

 

 

Excel Data Entry Popup List

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Last updated: February 18, 2020 12:31 PM