Forum Discussion
How can I create multiple dependent drop down lists
To create a unique country drop-down list that dynamically filters the provinces and districts based on the selected country and province, you can use a combination of named ranges, the INDIRECT function, and the INDEX function.
Here's how you can set it up (without having opened the file, for personal security reasons):
- Prepare your data:
- Column A: Countries
- Column B: Provinces
- Column C: Districts
- Define named ranges:
- Select the range of countries (excluding the header) in Column A.
- 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".
- Repeat the above steps for the ranges of provinces and districts, naming them "ProvinceList" and "DistrictList" respectively.
- 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: =CountryList.
- 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: =INDIRECT("ProvinceList").
- 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: =INDEX(DistrictList,MATCH(G2,ProvinceList,0)). This formula uses the INDEX and MATCH functions to retrieve the districts that match the selected province.
- Click "OK" to close the dialog box.
Now, when you select a country in cell E2, the province drop-down list in cell F2 will update based on the selected country. Similarly, when you select a province, the district drop-down list in cell G2 will update accordingly.
Make sure to adjust the cell references and named ranges according to your specific worksheet.
By following these steps, you can create a unique country drop-down list with filtered provinces and districts based on the selected country and province.