Linking Dropdowns with Data Validation
January 26, 2002 - by Juan Pablo Gonzalez
One good use of Data Validation comes when there's a need to "link" two or more dropdown list, making them dependant.
For example, John asks:
I have a list of countries (USA, Australia, England), and a list of cities. How can I make than when the user selects USA in one cell, in the other one appear only cities from USA (New York, Los Angeles), and also for Australia (Camberra, Perth), etc.?
The first thing that needs to be done is name the lists. Select the countries, without the title, and name it COUNTRIES. Next, select all cities (Again without titles) from USA and name it USA. Continue this process for every country.
Now, let's assume that the first list appears in A1. Go to Data, Validation, Select List, and in "Source" put:
=COUNTRIES
Make sure that "In-cell dropdown" is checked.
Now, if the second list appears in B1, go to Data, Validation, again Select List, and in "Source" put:
=INDIRECT(A1)
If Excel returns an error, don't worry, you don't have anything selected in A1. To test it, select a country in A1, and now, when you click in B1 you should see only the cities from that country.
Addition
Ian Narbeth asked to remind that Defined Names can't include spaces, so, to enter, Great Britain, you would have to put it like "Great_Britain" or "GreatBritain". Thanks for that.