On the web, there are many questions about how to create an expandable drop-down list that can be copied across multiple rows and very few answers. Here's a working solution.
The introduction of dynamic arrays has made our lives as Excel users a lot easier. Among many other things, they significantly simplify the creation of dynamic drop down lists. The above-linked tutorial shows how to quickly set up a multiple drop-down with dynamic arrays and make it expandable to automatically include new entries.
I felt very proud of the work we'd done until we got a few comments like this: "That works great for one row, but how to get this to work for the entire column?" A fair question. Indeed, Excel picklists are most often used in worksheets with hundreds of rows to facilitate data entry. So, we reconsidered the whole approach, worked out a formula that automatically adjusts for each row, and I'm thrilled to share this new solution with you!
Important note! Because this solution relies on the dynamic array feature, it is only applicable in Excel for Microsoft 365 and Excel 2021. In pre-dynamic versions of Excel, please use the traditional approach to creating multiple dependent drop down lists.
For starters, let's get some source data to work on. In our main table on the left, we want to have two picklists in each row, so that selecting a Dept. in the first list only displays Managers for that selected department in the second list. If you change the selection in the main list, the names in the dependent drop-down will update accordingly.
The source data for drop-down lists often come from different sources and are organized differently. So, our first step is to structure the original data according to our needs. For this, we are going to create some sort of preparation table that will list all different department names in the header row, and under each dept. name there will be a list of employees working in that specific department. To automate the work and prevent human errors, we will be using the following formulas.
To get the departments, enter this formula in H2.
Here, the UNIQUE function extracts all the different departments from E3:E15. The SORT function arranges the results in alphabetical order so that the items of your main list will be sorted from A to Z (if you don't want that, you can remove SORT from the formula, and the dept. names will appear in the same order as in your source table). Finally, TRANSPOSE changes the output orientation from vertical to horizontal.
Please notice that the formula needs to be entered just in one cell, and the results spill into neighboring cells automatically (this feature is called a spill range).
This way, we've got the items for our main drop-down list:
To pull the manager names, the formula in H3 is:
Here, we utilize the FILTER function to filter the employees that belong to a particular department ($E$3:$E$15=H$2). The SORT function arranges the names in alphabetical order (if you wish to preserve the existing order, remove it from the formula).
Like the previous formula, this one is also dynamic, and the whole spill rage is filled with the results at once. All you need to do is to drag the formula to the right to get a list of managers for each dept.
And this gives us the items for the dependent drop-down list:
Tips and notes:
With the source data properly arranged, create the first drop-down list in the usual way with the help of Excel Data Validation:
This syntax (cell address followed by a hash tag) refers to the entire spill range no matter how many cells it actually contains.
The primary drop-down list for the first cell is done:
Technically, setting up a successive picklist seems pretty easy - you just need to create one more data validation rule for another column. However, there's a tricky part - the formula for the Source box. This time, you cannot use a normal spill range reference because the second drop-down list needs to take into account the selection in the first drop-down. To solve this need, we'll be referring to a relevant spill range indirectly with this formula:
Putting all the above pieces together, we get the following formula for the dependent drop down validation rule:
=INDIRECT(ADDRESS(3, COLUMN(G1) + MATCH(B3, $H$2#, 0), 4) & "#")
Now, simply select the topmost cell for the secondary drop-down list (C3), go to the Data tab > Data Validation, and configure the rule like this:
That's it! The dependent drop-down list is good to go:
Tip. If your source data and the preparation table are on another sheet, then include the sheet name in the lookup_array argument of MATCH, and also concatenate it with the cell reference within INDIRECT like this:
=INDIRECT("Sheet1!"&ADDRESS(3, COLUMN(G1) + MATCH(B3, Sheet1!$H$2#, 0), 4) & "#")
In the above formula, simply replace Sheet1! with the name of the worksheet where your source data and the preparation table are kept.
How this formula works:
From my experience, many of our blog visitors are eager to know not only how to apply this or that formula but also understand its internal logic. For such curious and thoughtful users, I'm providing the detailed break-down of the formula:
=INDIRECT(ADDRESS(3, COLUMN(G1) + MATCH(B3, $H$2#, 0), 4) & "#")
On a high level, we utilize the INDIRECT function to "dynamically" refer to the spill range of managers corresponding to the department selected in the primary dropdown.
Suppose you picked Planning from the drop-down in B3. The employees of the Planning dept. are listed in column J beginning in J3. That means, we need to somehow supply the J3# reference to INDIRECT, and here's how we do it:
To get the column letter, the following 3 functions are used together:
ADDRESS(3, COLUMN(G1) + MATCH(B3, $H$2#, 0), 4)
The COLUMN function returns the column number of G1, which is 7.
The MATCH function searches for the B3 value in list of departments beginning in H2 and return its relative position, which is 3 (Analysis, Design, Planning, …).
Adding up these two numbers gives us 10, so the ADDRESS function takes this form:
ADDRESS(3, 10, 4)
Where 3 is the row number, 10 is the column number and 4 is the relative cell reference type. The result is the "J3" reference that goes directly to INDIRECT :) and reduces our tricky formula to an easy understandable one:
Concatenating a cell reference with a hash tag produces a spill range reference, so that INDIRECT returns an entire array rather than a single cell value. Done!
The beauty of this formula is that it works perfectly for a single-letter, two-letter and even tree-letter column (thank you Jonathan for pointing us in the right direction!).
This is the easiest part. For the picklists to appear in multiple cells, you can simply copy them like any other cell content by using the Copy / Paste feature or by dragging through the adjacent cells. For practice, we will try both techniques.
To copy the primary drop down list, select the cell containing it (B3) and drag the fill handle (a small square at the lower right-hand corner of the cell) through as many cells as needed:
To copy the dependent drop down list, let's do a regular copy/pasting:
Now, both picklists appear in every row letting you select a department and manager for each project.
Please keep in mind that the above methods copy all the contents of a cell including Data Validation and the current selection. So, they are best to be used when no item has been selected in the list yet.
If you've already selected the items, then you can copy only the Data Validation rule by using the Paste Special feature. Here's how:
Though our dynamic arrays solution is not a one-click setup, it's a way faster than it looks and definitely much faster than the old-fashioned approach with named ranges. Anyway, the result is worth the effort, agree?
Here it is - the dependent drop down for multiple rows where selecting an item from the first list determines which items will appear in a secondary drop-down.
If more data is likely to be added to your source table in the future and you wish to have new entries included in the drop-down lists automatically, then you will have to use a bit more complex versions of the formulas for the preparation table. There are 2 possible approaches here, a regular range and a full-fledged Excel table, each having its own caveats.
One of the key advantages of Excel tables is automatic expansion to accommodate new data, and we are going to leverage this ability.
The first thing you do is convert source data to a table. The quickest way is to select the range E2:F15 and press Ctrl + T. For convenience, we name the table Source_data.
Next, build the formulas for the preparation table by using structured references. If you are not familiar with this syntax, it's not a problem! Just start typing a formula in a cell, select the required range in your table, and Excel will create an appropriate structured reference for you automatically based on the column names.
To extract the departments, the formula in H2 is:
To get the manager names, enter the below formula in H3 and drag it to the right through a few more cells than there currently departments (say, through P3):
Play pay attention that absolute structured references should be used for the Dept. and Manager columns so the references won't shift when the formula is copied horizontally. The default in Excel tables is a relative column reference such as table[column]. To make the reference absolute, you need to repeat the column name like this: table[[column]:[column]].
The IFERROR function is used to prevent errors when the formula is copied to extra columns to the right.
If all done correctly, the preparation table expands automatically to incorporate new records:
If the table references look too complex to you, you can do with a normal range too. In this case, a couple of improvements need to be made to the formulas:
To extract the department names, the formula in H2 is:
Please pay attention that we use the range E3:E30, though currently there are far fewer records in our source table.
To get the manager names, enter the below formula in H3 and drag it through a few more columns than there are currently entries in the header row:
In this case, we lock the range references with the $ sign to prevent them from changing while copying the formula.
As with the previous solution, the new records appear in the preparation table once they are added to the source table.
Whichever approach you opted for, configure and copy two Data Validation rules like explained in Steps 2 - 4 above, and the newly added items will be displayed in the drop-down lists without any extra effort on your side!
That is my go-to for making a multiple drop down list in Excel. Hopefully, this solution will be useful for you too. Anyway, I thank you for reading and hope to see you on our blog next week!
Multiple rows dependent drop-down (.xlsx file)
Table of contents