Home > Validation > Dependent Drop Downs > Index Tables

Dependent Data Validation with INDEX and Excel Tables

Debra Dalgleish - Contextures

In this tutorial, Excel expert Roger Govier shows how to create multi-level dependent drop down lists, using Excel tables and named ranges. See how to set up the item lists, and the data entry section.

test the data validation drop down lists

1) Video: Multiple Dependent Drop Downs

This video shows how to set up multiple dependent drop down lists, using 2 Excel tables, and 3 named ranges. There are written steps below the video.

  • Tip: Go to the Sample Files section, to get the completed Excel file.

2) Set up 2 Excel Tables

In this example, there are two named Excel tables:

  • Data Entry: Select from multiple drop-down lists, to enter data
  • Lists: Items to use in the data validation drop-down lists

You can get the completed sample file in the Sample Files section, further down the page.

Or, follow the steps below, for a quick overview on how to set up the workbook.

2.1) Data Entry Table

To set up a data entry sheet, follow these steps:

Open a new workbook in Excel, and name the first sheet - Data Entry

  • In cells C5:E5, type the following 4 headings:
  • Region, Country, Area, Dity
  • Select the four heading cells
  • To create a named Excel table, press the keyboard shortcut - Ctrl + T

Data Entry table has been created on a sheet which itself has been named Data Entry - but it could have any name. First, the headings are typed on the sheet.

type headings on sheet

Next, a Table was created using the Table command on the Ribbon's Insert tab.

When the tables are created, you can choose whatever Formatting you want for the table from the Table Styles menu. In this case the Style chosen was Table Style Medium 2.

format the table

I also chose to give this table a name in place of the default Table1 and I named it tblData

change the table name

After the other tables are set up, data validation drop downs will be added to this table.

These will be dependent drop down list, with each list showing the items based on your selection in the previous column.

test the data validation drop down lists

2.2) Create the Second Table

In exactly the same way a list of the data required for the Data Validation was typed on another sheet (in reality it could be on the same sheet if required) and this was converted into a Table by the same method and this was given the name tblVal.

create the second table

3) Set Up 3 Named Ranges

There are 3 named ranges used in this method, and the setup for each range is described below.

drop down list lookup table with 3 named ranges

3.1) _Regions

This is the range that will be allocated as the data validation list for the column Regions in tblData. This is a fixed list, in that it relates only to the first column of data entry. The other named ranges will help to derive the single range that will be used for every other column on the data entry table, as each of these will be dependent upon the preceding column to the left.

For this range, I have used structured table referencing to refer to just the cells in the first column of the tblVal data, and only for those cells within this column that contain data. Using Formulas > Name Manager > New, I created the formula in the Refers To box as

=INDEX(tblVal[Regions], 1,1):INDEX(tblVal[Regions], COUNTA(tblVal[Regions]))

name the first range

With structured referencing, the reference tblVal[Regions] will return the column of data called Regions in the Table called tblVal. In this case it will return the range $D$8:$D$18. The great thing about tables is, although the returned range looks like an absolute range, it is in fact dynamic, and will grow if more data rows are added (and shrink if rows are deleted from the table.

However, this range, only has entries in cells D8:D11, and cells D12:D18 are empty. For our data validation, we only want a list of the cells with data so we need to adjust the range that _Regions returns to account for this. We do this with the INDEX function.

In the Refers to formula:

  • =INDEX(tblVal[Regions],1,1) will return the first cell within the range i.e. D8
  • =INDEX(tblVal[Regions], COUNTA(tblVal[Regions])) will return the cell represented by what is returned from the COUNTA function on range D8:D18 i.e. D11

As a result, the named range _Regions refers to D8:D11 and when used with data validation will show only the values that are available for selection, as in the screen shot below.

drop down list with available items

3.2) _MainList

This is the range which will identify which column of data from the table tblVal needs to be used as a dependency of the item in the cell to the left in the table tblData.

Let's look at a small section of our tblData

look at tblData

So, if we have selected Europe as the Region, we want to be shown a drop down list in column D under Countries of the countries that fall within Europe in the data validation table.

The formula which gives this range is

=INDEX(tblVal,0, MATCH(INDEX(tblData[@], COLUMN()-COLUMN(tblData)), tblVal[#Headers],0))

Let's dissect this to understand what it is doing. Index takes 2 parameters, firstly a row coordinate followed by a column coordinate.

=INDEX(tblVal,0

So, we are wanting to Index tblVal (which has the range $D$7:$R$18 on sheet Lists) and we have given it the first coordinate of 0. When the row coordinate is 0, index returns the whole column for the value provided by the column coordinate, so the result of this formula is going to be a whole column of values.

The column coordinate we are passing to Index, is a complicated Match function. What we want to find is the column name which has the same value as in the cell to the left of where our data validation formula is going to act. In this example, our data validation formula is going to be located in column D, and our dependent list will be based upon the value immediately to the left in column C, which is Europe

Finding the item we want to Match (Europe) is achieved by :-

INDEX(tblData[@], COLUMN()-COLUMN(tblData))

  • tblData[@] returns the whole row of data at the current row position - which will be $C$7:$F$7
  • COLUMN() returns the column number as is normal for this functions use anywhere within Excel, and as we are in column D, it will return 4
  • COLUMN(tblData) is part of structured referencing and will always return the column number of the first column in a Table, and for this table it will return the value of 3

So COLUMN()-COLUMN(tblData) will give us the relative position of the column and will return a value of 4 -3 = 1

Overall, then

INDEX(tblData[@], COLUMN()-COLUMN(tblData))

Will be equivalent to =INDEX($C$7:$F$7,1) which will return the value Europe

So now, we have the value to use in our Match function, and where we are trying to match this value is in the header row of tblData In structured referencing,

tblVal[#Headers] returns the range of the header row of the table, which in this case would return the range Lists!$D$7:$R$7

[Note: whilst the construct Column(tblData) returns the column number of the first column of a table, the construct Row(tbldata) returns the row number of the first row of the Datatbody of the table, in this case 8, and not the Header row, which is row 7 ]

  • MATCH(INDEX(tblData[@], COLUMN()-COLUMN(tblData)), tblVal[#Headers],0) therefore becomes
    • MATCH("Europe", tblVal[#Headers],0) the trailing 0 meaning we want to find an exact match, even if our data along the header row is not in a sorted order, and this then becomes effectively
      • MATCH("Europe",Lists!$D$7:$R$7,0) which returns the result of 4, as Europe is the 4th item in that range.

Our original _Mainlist formula thus is effectively INDEX(Lists!$D$7:$R$18,0,4) which as the first parameter is 0, will return us the whole of the column which is Lists!$G$7:$G$18

Before we move on to the next named range, take another look at the information above, and evaluate things as if you were in cell F6 of the small table above.

Stepping through the evaluation process here, you will see that

  • COLUMN()-COLUMN(tblData) will return a value of 6 -3 = 3 and
    • INDEX(tblData[@], COLUMN()-COLUMN(tblData)) will be equivalent to =INDEX($C$6:$F$6,3)
      • which will return the value Ontario

So this construct enables us to use structured referencing to give us the equivalent of the Volatile OFFSET function, and return a value which is one to the left =OFFSET($F$6,0,-1) which would also return Ontario

3.3) _UseList

Our final named formula is the one that will be used for all data validation entries in our table tblData, apart from the first column which will use _Regions.

We have seen how _Mainlist returns us the column of data that we want from our validation table tblVal. We have also seen that it returns us the complete column within the table, whether it contains data or not.

In the example above, the return was Lists!$G$7:$G$18, but if we look at the table, we can see that cells G16:G18 are blank cells. Since one of the main purposes of Data Validation is to ensure that users can only enter data that is valid, we do not want to offer them blank cells as part of their selection.

The named range _Uselist takes the output from _MainList and returns a set of data that are just the cells that contain data.

  • =INDEX(_MainList, 1,1):INDEX(_MainList, COUNTA(_MainList))

It is just like the formula used for Regions by using

  • =INDEX(_MainList, 1,1)

to give the first entry from the _MainList, and using

  • INDEX(_MainList, COUNTA(_MainList)

to provide the last cell reference that contains data.

So now we have a method of having any number of Dependent Data Validations using just three named formulae and Excel's Tables. The big advantage with Tables is they are automatically dynamic and will grow or shrink as we add more data to any of the rows.

Additionally, further dependencies can be added by adding more columns with a heading equivalent to one of the cell values in a prior dependency list, and there is nothing to add or alter to the formulae we have created.

The other tremendous advantage with Tables, is that they can be moved around at will anywhere within the workbook, without breaking any of the formulae. You don't have to ensure that you are in any specific cell within your data entry table when setting up the formulae to make it all work.

A workbook showing all of these features may be downloaded at the end of this page. To use this version, download the sample file with NO macros, below.

4) Create Data Entry Drop Downs

The final step is to set up Data Validation drop down lists in the main table.

  • The first column, Regions, is not dependent, and shows a list of all the regions, from the named range _Regions.
  • The other 3 columns -- Country, Area and City -- will have dependent drop downs, based on the named range _UseList.

dependent data validation drop down formulas

4.1) Regions Column Drop Downs

To set up the drop down lists in the first column (Regions), follow these steps:

  • First, select all the data cells in the Regions column
  • Next, on the Excel Ribbon's Data tab, in the Data Tools group, click the Data Validation button
  • When the Data Validation dialog box open, go to the Settings tab
  • First, click in the Allow box
  • Then, from the Allow drop down list, select List
  • Next, click in the Source box, and type this formula:
    • =_Regions
  • Click OK to close the Data Validation dialog box

4.2) Other Columns Drop Downs

To set up the drop down lists in the remaining 3 columns, follow these steps:

  • First, select all the data cells in the Country, Area and City columns
  • Next, on the Excel Ribbon's Data tab, in the Data Tools group, click the Data Validation button
  • When the Data Validation dialog box open, go to the Settings tab
  • First, click in the Allow box
  • Then, from the Allow drop down list, select List
  • Next, click in the Source box, and type this formula:
    • =_UseList
  • Click OK to close the Data Validation dialog box

4.3) Test Drop Down Lists

After you set up the data validation drop down lists, test them, to make sure they're working correctly.

  • First, select a region name in the first column
  • Next, select a country name in the second column
  • In the Area column, you can select an area from that country
    • Note: If the Area drop down doesn't work, no areas are in the values table for that country.
  • If you were able to select an Area, try the City drop down, and select a city from that area
    • Note: If the City drop down doesn't work, no cities are in the values table for that area.

test the data validation drop down lists

5) Get the Sample File

Get one of the following zipped sample workbooks --

6) Down the Rabbit Hole 🐰

In this section, you'll find related Excel tips, shortcuts, skills, and details. These things are nice to know, but not essential, so you can skip this section, and get back to work. Or dive in, for some extra Excel fun and knowledge!

--a) About the Developer

--b) Skills Spotlight

--c) Clear Cell Entries (Optional)

a) Function Spotlight

Here are the key Excel functions that I used for these examples.

a) Function Spotlight

Here are the key Excel functions that I used for these examples.

c) Clear Cell Entries (Optional)

Since Data Validation is all about ensuring that the user only enters valid data into cells, the "wheels can come off the wagon" if the user goes through the Selection process and chooses, for example Americas > Canada > Ontario > Toronto and then goes back and changes Americas to Europe. Clearly, the values following Americas will all be incorrect, unless the user does go and make each of the changes.

If you can accept a little VBA in your workbook, then the .xlsm version as shown below includes the following piece of event code to clear entries on the same row, to the right of the changed value. As there may well be further data in the Table which is numeric data and should not alter even if the prior values change, we need to inform the code how far it should clear the data.

I have used a Variable called maxcols in the code below, which has been set to 6 for this example, but you will need to alter dependent upon your own situation. The code below has been copied onto sheet Data Entry

NOTE: This macro uses the SendKeys method

Option Explicit

Private Sub Worksheet_Change(ByVal Target As Range)
Dim tr As Long, tc As Long, maxCols As Long
On Error GoTo exit_sub
tr = Target.Row: tc = Target.Column

'//// set the column number for the last column
'//// you want to be cleared automatically
'//// when an upstream cell is changed
'//// Often you will have other
'//// numeric data in a table which
'//// does not need to be cleared
'//// if other values are amended

maxCols = 6

'//// In this example, there are dependent validations
'//// in columnc to F so maxcols has been set to 6

If Target.Count > 1 Then GoTo exit_sub
If Not Intersect(Target, _
      Me.ListObjects(1).Range) Is Nothing Then

'/// Assumes there is a single Table on this sheet,
'///   hence ListObjects(1) can be used,
'///  it does not have to be named.
'/// You can be specific and use the form
'/// If Not Intersect(Target, _
'///   Me.ListObjects("tblData").Range) Is Nothing Then

    If tc = maxCols Then GoTo exit_sub

    Application.EnableEvents = False
    If tc < maxCols Then
        Range(Cells(tr, tc + 1), _
          Cells(tr, maxCols)).ClearContents
    End If
    
'////  This next section checks whether
'////  the cell has had an entry made,
'////  and if so uses Sendkeys to automatically
'//// show the drop down list of possible entries,
'//// without having to click the drop down arrow.

If Target <> vbNullString Then
        Target.Offset(0, 1).Select
        If ActiveCell.Validation.Type = 3 Then
            Application.SendKeys ("%{DOWN}")
        End If
    End If
End If
exit_sub:
    Application.EnableEvents = True

End Sub

In addition to clearing entries ready for new values to be selected, the code checks to see if a new value has been entered into the cell (as opposed to just a deletion of value) and if so, it selects the cell one column to the right.

A check is then made to see if this newly selected cell contains Data Validation, and if so it produces the list of appropriate drop down values ready for the user to select, without the need for them to click the arrow in the cell first to produce the list. This can speed up data entry considerably.

  • Note: To use this version, download the sample file WITH macros, below.

About the Developer

Roger Govier

Roger Govier is an Excel MVP based in the UK who undertakes assignments in Excel and VBA for clients worldwide. While he enjoys the intellectual challenge of solving problems with worksheet functions, Roger always looks for fast and simple ways to provide solid workable solutions.

Get Monthly Excel Tips!

Don't miss my monthly Excel newsletter! You'll get quick tips, article links, and a bit of fun. Add your email, and click Sign Up.

Next, when you get my reply, click the Confirm button. I add this step to protect you from spam!

Video Transcript

'-----------START OF TRANSCRIPT-----------------

In this video, you'll see how to set up drop down lists in Excel, where you can choose from a first drop down, and then the next one depends on what you've selected in that first one, and so on.

Workbook Demo

So now we're at the third one where we can only see items from Canada and a fourth level where we see cities for the Ontario region.

This is Debra Dalgleish from contextures.com, and I'll show you how to set this up.

Workbook Overview

This is the Data entry sheet, and I've got data validation set up here where we're choosing from these drop down lists.

There's another sheet called Lists. And on here, we have a big table with a column that shows our first drop downs, which are the regions.

  • And then for each of those regions, we have a list of countries.
  • And for some of the countries like UK, France, we've got more lists that give us our third drop down.
  • So from the UK, you could choose England. And then for England, we have a list of cities.
  • For France, we've got a lot of regions.
  • For the US, just a few, but we could add all fifty of the states if we wanted to.
  • We've just got Washington and California. But if we set up a state name here, we could then add a column and show some cities in that state.

So what we're going to create is a very flexible setup that will let you put in as much as you need to create these customized dependent drop down lists.

Start the Workbook

You've seen the completed workbook with the dependent drop downs and now you're going to see how to set it up from scratch.

So this is a new workbook.

I have two sheets, Data entry and Lists.

Data Entry Sheet

And on the data entry sheet, I just put the four column headings where we're going to select items from the drop down lists.

  • Regions, country, area and city.

And, I'm just going to put a x right there just to create a a beginning for this row. I'll get rid of that later.

But we're going to change this to a named table.

  • So select any cell in the heading and on the Home tab, go to format as table and select the style that you would like.
  • So it's selected the correct cells.
  • I'm going to check the box that says my table has headers and there's my table.

And we'll come back to that later, but before I leave it, it got a default name of table one.

  • I'm going to call this tblData, and press Enter.

So that table is named.

Lists Sheet

And now we'll go to the Llist sheet where we're just getting started here too.

  • I've put a heading REGIONS and these are the four regions.
  • These four are going to become column headings and we have to match exactly.
  • So you can't type Americas here and try to match America up here.
  • And an easy way to do that is to select and copy, then click where you want the headings to go.
  • And for paste, choose Transpose.

Now I'm going to pause for a minute and enter some data here.

Next, I'm going to turn this into a named table as well.

  • So select any cell, go to Home, Format as Table, select a style, and again, this has headers, so click OK.

And there's our table and this will have all the values in it that we're going to use for the lists.

  • So for this table, I'm going to call it tblVal.

Add More Columns

What we've done so far is set up a list of regions, which we'll be able to select from.

And then from one of those regions, you'll see a list of areas in that region.

If we go back to data entry, we're going to have a drop down here and we're ready now.

Based on what was selected here, we can show countries.

  • We're going to add a couple more table columns to show some areas in some of our countries and some cities.
  • So back here, we've got all of these areas that we could use as column headings.
  • I'm going to put a couple over here.
  • Let's do UK and Canada.

Now we can put some of the regions from the UK and some of the Canadian provinces.

So if you pick one of those, you'll have another list that you can select from.

And we'll take one more look at our data entry sheet.

  • So now we can select a region and a country.
  • And say you picked Canada here, now you'd be able to pick some provinces.

And we'll make just a couple more columns in our values table with some cities.

I'm going to add headings that match what we've got in our list - so England and Ontario.

  • And now I'll put a couple of cities in these lists, and I'll be right back.
  • Okay, I have two more columns now, England and Ontario and cities within those areas.

And so this table, we could keep expanding if we wanted details for any of these other items, but this will give us enough to set up our drop down lists.

Create Named Ranges

Next, we're going to create three named ranges.

One will just be a list of these regions, and the other two will help us build a list based on our previous selection.

So these will create the dependent lists for our drop downs.

  • I'm going to explain what the formulas do, but if you're not interested, you can just copy and paste from the sample file, put those into your workbook, and then skip ahead to the section where we create the dropdown lists.

We're going to be creating dropdown lists on our other sheet.

And to do that, we're going to be referring to named ranges where the values are that we want to show in each list.

Our first list is going to be Regions and we could add more regions, but it's always going to be this column that the values will come from.

  • So we're going to create a named range called _Regions, and it's going to have this formula as its definition.
  • We'll use the INDEX function to look through tblVal, the regions column and get the first row and the first column.
  • So that will be this cell where our range starts.
  • Then it goes down using the INDEX function in that column again, go down based on the COUNTA, so count any items in that column.

There are four values here, so it will start here and go down to the fourth row.

  • So I'm going to copy this with control c.
  • And then to create the name, I'll go into formulas, name manager, new, and here's where I'll type _Regions.
  • I use the underscore so that will show up at the top of the list of names.
  • And here, I'll widen this a bit.
  • I'm going to delete what's in there and paste with control v.
  • Oh, there's a space there, so I'm getting rid of that.
  • So there's my formula, and I'll click OK.

And now if I click down in this box, it highlights that list for me.

So we've set it up correctly. I'll click Close.

Named Range #2

We've set up one named range _Regions, and we have two more to set up.

The next one is _MainList and it's going to give us a column out of this table of all our items that we've created.

I'm going back to the data entry sheet and I've just typed some values in here, a region and a country from that region. So we can see how this formula is going to work.

  • It is going to use INDEX and it will look at the tblVal, which is this table.
  • We have to tell it which row and which column.
  • For the row, we're going to use a zero.
  • And that means return all the rows in that column.
  • We have to find the column that matches whatever it is we want to see as a list.
  • So here, if we're in area, we want to see the Canada list.
  • If we were here, we'd want to see the Europe list.

To find that number of the column, we have to look for something in the headers, and we're going to use INDEX to find out where we are in this table, which is called tblData

  • Look at what column number we're in right now, and
  • subtract the column where this little table starts,
  • and that's going to tell you where to look for our value.

So here, INDEX(tblData, this means the entire row.

So if I'm here, I'm in column four, starts in two, which means look in the second column.

  • So this named range is going to give us a full column.
  • So in this cell, it should come over to Canada and it will select this whole list.
  • If we were in this row and looking at UK, it would select the whole list.
  • So there'd be a blank cell here in other columns or might not be blanks.
  • Our next named range will take care of the blanks.

But for now, we wanna find the entire column based on whatever we selected in the cell to the left.

  • So I'm going to copy this formula
  • Then go to Formulas, Name Manager
  • Create a new name, and this is going to be called _MainList
  • And paste the formula here.
  • Click OK.

And there's our main list.

  • If I click inside here, it's not finding anything because I'm not in a cell with something beside it.
  • So I'm going to click up here for area, go back in name manager and click.
  • And now it's highlighting that list for Canada.

So that's doing what we need it to do.

Named Range #3

Now we'll create a third named range and this one will be used for the dropdown lists.

We're going to call this _UseList and it is going to be based on the one we just created called main list.

  • So in this example, UK main list would be all these cells in this column.
  • The _UseList will count those items and just return a list of cells that have items in them.
  • It won't include the blank cells.

Here's the formula that we're going to use.

So we'll INDEX the _MainList, starting from the first row and cell down to in that main list to a count of items in the main list.

  • I'm going to copy that formula and go to the name manager.
  • Create a new name, call this use list, and I'm going to paste in the formula that I copied.
  • Click OK and click close.

So if I'm in this area cell for Americas, Canada and go to the name manager and click _UseList.

It shows the list of the Canadian provinces.

Make Drop Down lists

The final step is to set up the dropdown lists.

We're going to have one drop down for the regions and then a different drop down for all the other columns.

  • I'm going to clear out all the data in this table.
  • Just delete it and select the two regions cells.
  • To add the drop downs, go to data, validation, select list.
  • And for the source, if you're on a Windows computer, click in the source box and press the F3 key, and it will bring up a list.
  • If you don't have this shortcut available, you can type equals and then a list name.
  • For this, we're going to use regions and click OK, OK

And now you can select a region in each of those rows.

I'm going to choose Europe and Americas.

Dependent Drop Downs

Now we're going to set up the drop downs that are dependent on the previous cell in all of the other columns.

  • So I've selected all of them, data validation, list, and for the source, again, I'll press f three.
  • And this time, we want the used list.
  • So this is our dependent list.
  • It will show a list based on what was selected in the column to the left.
  • Click OK and OK.

So now, if I have selected Europe, the countries show Europe.

  • So I can select any one of those.
  • I'll select UK.
  • And for that country, we have areas, and we could choose a city as well.
  • For the Americas, if I select a country, I can choose Canada - it has areas.
  • I'll choose Ontario because I set up cities for those.

If I press tab to start a new row and then:

  • Choose a region that doesn't have all the details
    • I can still choose one of the countries.
  • But when I get to area, I haven't set up anything for China.
  • So the drop down list just won't work.

For more Excel tips and tutorials and to download the sample file for this video, please visit my website at www.contextures.com.

'-----------END OF TRANSCRIPT-----------------

Related Tutorials

Data Validation Basics

Dependent Drop Down Setup Choices

Dependent Drop Downs, Advanced

Create Dependent Lists

Dependent Dropdowns from a Sorted List

Dependent Lists With INDEX

Data Validation Criteria Examples

Data Validation Tips

 

Last updated: February 16, 2026 3:26 PM