Dynamic dependent drop-down list in Excel

Download the Dependent Drop-Down Workbook

Get the practice file with both methods from the video: OFFSET and Excel Tables with INDEX. The second list grows with new entries and skips the blanks.

The drop-down list should display App names based on the Division selected by the user.

Dependent drop-down list that should expand when new items are added

Create the First Drop-Down List

Add data validation to a selected cell.

Go to Data > Data Validation symbol.

Data Validation button on the Data tab

Under Validation Criteria, select List.

For the Source, do a cell reference to the Division names, which are the table headers (cell A4:C4).

Data Validation dialog with List and the division headers as source

If set up correctly, it should display as follows:

First drop-down showing Productivity, Games and Utility

Method 1: Dependent Drop-Down with OFFSET

Build the OFFSET Formula in a Cell First

Whenever a formula is to be used as a data validation criteria, it is usually easier to first set the formula up on the spreadsheet, then transfer it to the data validation window so that all the Excel helper tips show up as guides.

New to OFFSET? Start with how the OFFSET function works.

The OFFSET() formula has the syntax:

= OFFSET(reference, rows, cols, [height], [width])
  • reference = starting point, $A$4
  • rows = how many rows going down until the first value to be used. In this case, since we want to start one row below the header, we input 1
  • cols = how many columns to the right until the first value to be used. In this case, this is dependent on the selected Division by the user. A MATCH() formula comes in handy since it returns a number:
MATCH(lookup_value, lookup_array, [match_type])
  • lookup_value = source, $F$4
  • lookup_array = where the lookup will be done, $A$4:$C$4
  • match_type = 0 for exact match

It now becomes: 

MATCH($F$4,$A$4:$C$4,0)
OFFSET formula with MATCH for the column argument

However, this can’t be used as is since the return value of the MATCH() function will be 1, 2, or 3 depending on the selected division.

What this means is that when the Productivity division is selected, the MATCH() function returns a “1”, which tells the OFFSET() function to move one column to the right instead of staying in column A.

To fix this, a correction is made by deducting 1 from the MATCH() function.

The col parameter now becomes:

MATCH($F$4,$A$4:$C$4,0)-1
MATCH result corrected by subtracting 1
  • [height] = how many rows will be included. This should correspond to the number of apps listed for each division and be dynamic to expand and contract. The COUNTA() function comes in handy since it counts cells with numbers or text.

COUNTA works when each list has no gaps. If a list has an empty cell in the middle, the drop-down will cut off the last item, so keep each list together.

COUNTA(value1, [value2], …)

However, since the cell reference changes depending on the division selected by the user, another function should be introduced.

The OFFSET() function can also be used here.

OFFSET(reference, rows, cols, [height], [width])
  • reference = starting point, $A$4
  • rows = how many rows going down until the first value, 1
  • cols = how many columns to the right until the first value to be used. This will again depend on the division selected. The same MATCH() function will be used here:
MATCH($F$4,$A$4:$C$4,0)-1
  • [height] = how many rows will be displayed. Use a bigger height than what is expected to make sure additional cells are taken account of. An arbitrary number 20 is used for this example, which should be sufficient. This value can be changed later on.
COUNTA and OFFSET counting up to 20 rows in the selected column

This now becomes:

COUNTA(OFFSET($A$4, 1, MATCH($F$4, $A$4:$C$4,0)-1, 20, 1))
  • [width] = how many columns will be included. Since we only need one column, set this as 1.

The final formula now becomes:

=OFFSET($A$4, 1, MATCH($F$4, $A$4:$C$4, 0)-1, COUNTA(OFFSET($A$4, 1, MATCH($F$4, $A$4:$C$4, 0)-1, 20, 1)), 1)

A single value will be displayed in the cell.

However, the formula actually returns an array and is unable to display all the values on a single cell.

To view the entire array, click inside the formula bar and press F9.

Press Esc to leave without changing the formula.

Pressing F9 in the formula bar to show the full list of apps

Add the OFFSET Formula to Data Validation

Copy the entire formula.

Add data validation criteria to cell F5 through Data > Data validation.

Under validation criteria, select List.

Paste the formula to the source text box.

Data Validation source with the OFFSET formula pasted in

Method 2: Dependent Drop-Down with Excel Tables

Turn Each List into Its Own Table

Instead of converting the entire data table as one Excel table, convert it into 3 Excel tables.

To do this, highlight each data column (CTRL+SHIFT+DOWN when selecting the header).

Selecting one list column with Ctrl + Shift + Down

Press CTRL + T.

Double check if the cell referencing is correct.

Tick the box to indicate that the table has headers.

Create Table dialog opened with Ctrl + T

Change the table name to the division name.

In this example, we use TableProd.

Table renamed to TableProd in the Table Name box

Do the same for the Games and Utility columns and rename them to TableGame and TableUtility.

Pick the Right Table with INDEX and MATCH

The INDEX() formula can be used to make sure the correct Table is used as reference.

There are two syntax options for INDEX().

The second option will be used.

INDEX function showing its two syntax options
INDEX(reference, row_num, [column_num], [area_num])
  • reference = instead of selecting an array of cells, the tables should be selected. To do this, hover over the header until a black arrow shows up.
Selecting a table column with the black arrow on the header

Selecting it should now display the table name with the column name in square brackets: 

TableProd[Productivity].

Select the other 2 columns in the same manner and enclose all 3 in parenthesis.

This now becomes:

(TableProd[Productivity],TableGame[Games], TableUtility[Utility])
Three table references inside brackets as the INDEX reference
  • row_num = how many rows going down will be included. Since all rows should be included, skip this argument by using a comma.
  • [column_num] = how many columns will be included. Since there is only one column for each table, there is no need to specify the column number. Skip this argument by using a comma.
  • [area_num] = how many areas to move. This can be dictated by a MATCH() formula.
MATCH($F$4,$A$4:$C$4,0)

The final formula now becomes:

=INDEX((TableProd[Productivity],TableGame[Games],TableUtility[Utility]),,,MATCH($F$4,$A$4:$C$4,0))
INDEX formula with MATCH choosing the area for the selected division

Similar to method 1, a single value will be displayed on the cell.

However, the formula actually returns an array.

To view the entire array, click inside the formula bar and press F9.

Pressing F9 to show the list returned by the INDEX formula

Use Name Manager for the Data Validation Source

Copy the entire formula.

Add data validation criteria to cell F5 through Data > Data validation.

Under validation criteria, select List.

Paste the formula to the source text box.

INDEX formula pasted as the Data Validation source

You might receive a message box indicating a problem with the formula.

Excel error message when the table formula is used in Data Validation

This is because data validation is unable to use this type of table referencing.

To remedy this, paste this formula in Name Manager.

This is found under Formulas > Name Manager.

Name Manager button on the Formulas tab

The Name Manager will pop up and display the three tables.

Click on New.

Name Manager showing the three tables

Give the formula a new name and paste the formula in the last text box.

New Name dialog with mylist and the INDEX formula

It should now show up on the list.

Name Manager with the new mylist name

Go back to Data Validation.

Under validation criteria, select List.

For the source, write the name of the formula.

If you have forgotten the name of the formula you have recently added to Name Manager, press F3.

Paste Name dialog opened with F3 in Data Validation

If set up correctly, it should now display the App Names in the dropdown list.

Data Validation source set to mylist
Dependent drop-down showing only the Productivity apps

Microsoft 365: Use FILTER and a Spill Range

If you have Microsoft 365 or Excel 2021 or later, you can skip OFFSET and the Name Manager. Put this formula in a helper cell, for example H5:

=LET(col, INDEX($A$5:$C$100, 0, MATCH($F$4, $A$4:$C$4, 0)), FILTER(col, col<>""))

It returns only the filled cells of the selected division and spills down. Then set the Data Validation source of F5 to the spill range:

=$H$5#

The drop-down grows and shrinks with the list. Learn more about the hash sign in Excel formulas.

Want users to type to search the list? Try a searchable drop-down list.

Download the Dependent Drop-Down Workbook

Get the Practice Workbook

Both methods from the video, ready to try with your own lists.

Frequently Asked Questions

How do I create a dependent drop-down list in Excel?

Create the first drop-down with Data Validation and a list of the categories. For the second drop-down, use a formula as the list source that returns only the items for the selected category, for example OFFSET with MATCH, INDEX with Excel Tables, or FILTER in Microsoft 365.

How do I remove blank cells from a drop-down list in Excel?

Size the list to the filled cells only. With OFFSET, use COUNTA as the height argument. In Microsoft 365, use FILTER to keep only non-empty cells in a helper range and point the drop-down to that spill range.

How do I make a drop-down list expand automatically?

Base the list on an Excel Table, on an OFFSET formula with COUNTA, or on a spill range. New items added to the list then show up in the drop-down without changing the source.

Why does data validation reject my table formula?

Data validation does not accept this type of table reference as a list source. Save the formula as a name in Formulas, Name Manager, then type an equal sign and that name as the source.

Can I use the FILTER function in a drop-down list?

Not directly in the source box. Put the FILTER formula in a helper cell, then use its spill range as the source, for example =$H$5#. This works in Microsoft 365 and Excel 2021 or later.

Why does the second drop-down keep its old value when I change the first one?

Data validation only checks new entries, so it does not clear a value that is already in the cell. Clear the dependent cell by hand after changing the first drop-down, or use a short macro to clear it automatically.

Leila Gharani

Founder of XelPlus and ten-time Microsoft MVP. Leila helps over 500,000 professionals master Excel, Power BI, and data automation through practical, real-world training.