Anyone know how to make a dropdown list dependent on the contents of 2 other dropdowns?

Copper Contributor

I'm trying to create a form with Province, City, District dropdowns being dependent on each other. I was able to create the dropdown for the provinces and make city dropdown only populate cities within the selected province, but when it comes to districts in the province/city combination i cant seem to get results. Can anyone help?

10 Replies

Hi Francis,

 

Here is an example with 3 dependent lists (Country, Region, City), i guess close to your case

http://www.contextures.com/xlDataVal02.html

 

Hi Sergei!

 

Thanks for the quick response! I tried this method but this doesnt seem scalable to large quantities of data as i would have to make multiple verticals per state. Im actually working on the entire philippines and have attached the sample data to help clarify would you happen to know of any alternative?

Hi Francis,

 

Okay, i see the point. Will play with this bit later.

Hi Francis,

 

I continue with your data structure, the only uses your Tables instead of ranges like $A:$A - better at least from performance point of view.

Instaed of Table1`,.. they are renamed as Province, ProvinceCity and AllData.

Name of the used columns are added to list of names (see in Names Manager), references as here

 

Names.JPG

 

Thus for the first list (Province) the formula is

=INDIRECT(ProvinceList)

(to work with tables we have to use INDIRECT, structured references don't work within list formulas)

 

Next one for the City which depends on Province is actually as yours, only in tables notation

=OFFSET(Lists!$D$1,MATCH(A2,INDIRECT(PCProvince),0),1,COUNTIF(INDIRECT(PCProvince),A2),1)

For the third list we shall filter selected Province and City what we do in MATCH with AND condition; and number of rows is calculated by COUNTIFS with two conditions (instaed of COUNTIF)

=OFFSET(Lists!$G$1,MATCH(1,(INDIRECT(AllProvince)=A2)*(INDIRECT(AllCity)=B2),0),2,COUNTIFS(INDIRECT(AllProvince),A2,INDIRECT(AllCity),B2),1)

The file is attached

 

@Sergei Baklan I stumbled across this post from over two years ago and it fits an issue I am trying to resolve as well. I followed the listing.xls file you posted but the dropdown in column C does not appear to be working. Something seems to be wrong with the data validation in that column as none of the Barangay dropdowns work. Do you know what needs to be fixed in the validation formula for this dropdown? Id like to apply the concept to a Dependent Validation drop down table I have setup but cant get it to work.

@Trevelyan 

You are right, third column doesn't work properly. If open data validation settings and Ok list in the cell is shown for a while, after that stop working.

 

Anyway, that's a bug, so far don't know there. Could you please say me are you on Excel; version with dynamic arrays or not?

 

Thank you

@Trevelyan 

For last 3 cells I use named formula for data validation and it works. For thirst 3 it is direct formula and it doesn't work after re-opening.

image.png

Will play some more with that, but later.

@Sergei Baklan Thanks for the prompt reply. I am office 365 for the Excel version. Ill take a look at the updated file today. I did some searching yesterday on it and it appears Arrays cause problems in the data validation. They work while the file is open after you enter the formula. But if you save and close, then reopen the file, it no longer works. 

@Trevelyan 

Yes, exactly the same issue on some other files. But that's not only on Excel with Dynamic Arrays, I checked on semi-annual version (pre-DA Excel) - same story.

@Francis Cleofe 

Maybe this file helps too ... had it in my archive ... it was a long time ago ... I think I downloaded it from a German forum (hmmm i dont remember it) ... anyway thanks to the donor ... try it maybe it will help you just as well ... if not ... delete it :)
 
Nikolino