Home > Software engineering >  Excel: Dynamic dropdown list
Excel: Dynamic dropdown list

Time:12-01

I have a static "Roles" table on one side:

ROLES
Project Manager
Designer
Developer

And a 2 columns "Name" and "Role" table on the other side:

NAME ROLE
Mark Project Manager
John Designer
Suzie Developer
Fred Project Manager
Julie Developer

Now I'd like to have two dropdowns:

  • the first (Role) would be static (based on the first "Roles" table, easy to do with Data Validation)
  • the second (Name) would be dynamic, querying the second table based on the first dropdown's choice

Example: if I choose Developer in the first dropdown, I'd like to have Suzie and Julie in the second dropdown.

enter image description here

Which gives me:

enter image description here


To make it a little more robust we can create three ranges that return each list.

I put the titles in D1:F1 and then used =FILTER($A:$A,$B:$B=D1)in D2 and drug it over to F2.

enter image description here

Then I create three named ranges. The name was the Role and the Formula was like =Sheet5!$D$2# respectively. I needed to add _ in place of the space.

enter image description here

Then in the formula for the data validation I used =INDIRECT(SUBSTITUTE($G1," ","_"))
enter image description here

That way I can now drag it down and it will refer to the cell in column G of the same row and change the list accordingly:

enter image description here

  • Related