Forum Discussion
Lycias
May 23, 2023Brass Contributor
How can I create multiple dependent drop down lists
I want to create multiple dependent drop-down lists from the file below. When I select a country in column B I want only entries from column D for that country to appear in the next drop-down list, a...
NikolinoDE
May 24, 2023Platinum Contributor
Maybe you can follow these modified steps:
- Prepare your data:
- Column B: Countries
- Column 😧 Provinces
- Column F: Districts
- Define named ranges:
- Select the range of countries (excluding the header) in Column B.
- Go to the "Formulas" tab, click on "Define Name" in the "Defined Names" group.
- In the "New Name" dialog box, enter a name for the range, e.g., "CountryList".
- Set up the first drop-down list for countries:
- Select the cell where you want the country drop-down list to appear (e.g., cell E2).
- Go to the "Data" tab and click on "Data Validation" in the "Data Tools" group.
- In the "Data Validation" dialog box, select "List" in the "Allow" drop-down list.
- In the "Source" field, enter the formula: "=UNIQUE(B2:B)".
- Click "OK" to close the dialog box.
- Set up the dependent drop-down list for provinces:
- Select the cell where you want the province drop-down list to appear (e.g., cell F2).
- Go to the "Data" tab and click on "Data Validation" in the "Data Tools" group.
- In the "Data Validation" dialog box, select "List" in the "Allow" drop-down list.
- In the "Source" field, enter the formula: "=IF(E2<>"", UNIQUE(FILTER(D2:D, B2:B=E2)),"")".
- Click "OK" to close the dialog box.
- Set up the dependent drop-down list for districts:
- Select the cell where you want the district drop-down list to appear (e.g., cell G2).
- Go to the "Data" tab and click on "Data Validation" in the "Data Tools" group.
- In the "Data Validation" dialog box, select "List" in the "Allow" drop-down list.
- In the "Source" field, enter the formula: "=IF(F2<>"", UNIQUE(FILTER(F2:F, D2:D=F2)),"")".
- Click "OK" to close the dialog box.
Now, when you select a country in the country drop-down list, the provinces will dynamically change based on the selected country. Similarly, when you select a province, the districts will adjust accordingly.
Make sure to adjust the ranges and references in the formulas to match your actual data range.
Lycias
May 24, 2023Brass Contributor
NikolinoDE, thanks again - when I do that for the first drop-down list, I get this error "The source currently evaluates to an error. Do you want to continue" from the data validation window.
- NikolinoDEMay 24, 2023Platinum Contributor