Before we had the luxury of dynamic array functions, creating dependent data validation lists typically required using multiple tables and named ranges, as shown here. Setting them up was laborious, however now that we have dynamic array functions, creating dynamic dependent data validation lists is much easier.
Note: this technique requires a Microsoft 365 license for access to dynamic array functions. If you don’t have 365, you can use this technique.
Watch the Video
Enter your email address below to download the sample workbook.
Dynamic Dependent Data Validation with Dynamic Arrays
In the table below called TblRegions I have a list of my countries and some of their regions:
In cell H4 the UNIQUE function extracts a list of sorted country names which are transposed across the columns to form the headers for the region lists:
The result of the formula in cell H4 also feeds the data validation list for the countries. Notice the use of the # sign in the Data Validation List cell reference: $H$4# This ensures the data validation list will pick up any new countries added to the TblRegions table.
In cell H5 the FILTER function returns the list of regions for the country in row 4. I’ve wrapped it in the SORT function to ensure the list returned is sorted alphabetically.
Note: you cannot use the FILTER function directly in the data validation list Source field because this field requires a range as opposed to the array of values returned by FILTER.
The data validation list uses the XLOOKUP function to return the range containing the list of regions for the country selected in column B. Notice the use of absolute and relative referencing on the lookup column ‘B’ and the use of the # sign to return a dynamic range (watch video for specific instructions):
With this approach any updates to the TblRegions will automatically be included in the data validation lists.
Firstly allow me to thank you once more for your video and detailed explanation.
Currently, I have 2 questions I was hoping you would help me with.
First and the most important question is:
In your video you’ve described the case when you have countries and regions and how to make them co-dependent.
What if I would like to add a 3rd column as well?
So to have a Country column, Region column, and let’s say a City column.
What I try to achieve is, when I choose a Country, to have accordingly a selection of regions of that country as you already showed us in your video. Then, when I choose the Region, I would like to have on a 3rd column again dependent data of cities, based on the region that I chose.
Is that possible?
Ex. I choose Country Greece, then based on this it gives me specific region options in the Region Column and I choose the region Attiki, than based on the Region that I choose in a 3rd column of cities I want to have the options of the cities that are in Attiki region and to choose Athens.
So 3 columns where each cell depends on the previous one and gives only the options related to the previous column.
I hope I didn’t describe it too complicated.
I did everything step by step as you did in your video and everything worked, however when I create the
Sort(Filter(Tb1Regions[Region],Tb1Regandions[Country]=H4 and drag it to the right for the other cells to take this formula, it for some reason changes the formula and makes it like this for some reason. Sort(Filter(Tb1Regandions[Country],Tb1Regions[Region]=H4
SO basically it changes the country and region places inside the formula and I need to manually fix it.
It however doesn’t change like this for every cell I drag it to, but to every second cell.
To answer your first question, yes you can do this by replicating the same steps for the city data. If you’re stuck, please post your question on our Excel forum where you can also upload a sample file and we can help you further.
To answer your second question, don’t drag to copy. Copy the cell with CTRL+C and then paste the formulas. This will result in the references remaining locked, rather than picking up the next column name.
With reference to your video on dependent data validation, i want to ask you a doubt. Since, no one is answering me for that.
At the video 6min 24 second, you have selected Country as “UK” and Region as “Essex” and other two countries with its Region. Now my doubt or my question is, If I change “UK” to “USA”, then will the region automatically changes or the data validation list changes automatically to “AL” without clicking in region data validation. Beacuse normally it remains under same UK regions when we select Country as USA.
Please support for my doubt and how to do this. Also, request you to suggest with your best excel courses in linkedin.
Thanks and Regards,
The region does not automatically change if you choose a country that no longer matches the previously selected region. You must click in the region cell and choose a new region. The data validation list will be updated to show regions that match the now selected country. You can download the example file above and try it yourself and you’ll see.
I don’t put my courses on LinkedIn. You can see my course options here.
for the first method,you can in the data validation box use =indirect(“country[Country]”). -> (“tableName[columnName]”)
So you don’t need to set the named range.
Yep, nice tip! Thanks for sharing. I tend to avoid INDIRECT because it’s volatile, but if used sparingly it’s fine.
if you enter another country, the “2nd” Dropdown list *does not expand*, so only the first dropdown is dynamic…. It still only refers to columns H to J in your example file, the new column (K) is not included….This is a waste of time and useless, please propose a solution where the “secondary” (or dependant() dropdowns for a 4th country also work!
To dynamically expand the regions for more countries, copy the FILTER function across more columns and use the ‘not found’ argument in FILTER to return blank with two double quotes, e.g.:
Then modify the XLOOKUP to also include further columns e.g. if your FILTER formulas are in columns H:P your XLOOKUP would be: