• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Table multiple filters with drop downs

Costas

Member
Hi Chandoo,

I've got a tricky one to ask. I've got an excel table with a list of countries, their states and territories and major cities.

I want to create a drop-down of the countries and another drop-down of states and territories that filters to the country selected in the first drop-down.

Below these two drop-downs, I want to have a list of the cities that satisfy the two criteria.

65849

I'm thinking of writing a code on change but wanted to ask if there is another alternative with advanced filter perhaps or something else. I attach my file for more info.

Thanks
Costas
 

Attachments

  • Capture.JPG
    Capture.JPG
    27.8 KB · Views: 1
  • Multiple filters.xlsx
    14.5 KB · Views: 2
There are multiple ways to do this. Actual solution will depend on your Excel version, use case and user's Excel version (backward compatibility requirement).

With your current Output sheet set up. Advanced Filter can't be used. Criteria column header and data headers all must be exact match to headers in "Data" sheet.

Have a read of...
https://www.contextures.com/xladvfilter01.html

If using Office 365.
=FILTER(Table1[City],(Table1[Country]=Output!B1)*(Table1[State/Territory]=Output!E1))

If you need backward compatibility...
=INDEX(Table1[City],AGGREGATE(15,3,(ROW(Table1[City])-1)/((Table1[Country]=$B$1)*(Table1[State/Territory]=$E$1)),ROWS($A$1:A1)))

Copy down as much as you need. If you don't want to see error values. Nest it in IFERROR(Formula,"")
 
Hi Chihiro,

Many thanks for your reply.

I'm using Office 365 but couldn't get the filter function to work but the second option works fine.
My only problem now is that the drop down of Output E1 still shows all states instead of just the ones for the country selected in Output B1. I attach the revised file.

Thanks
Costas
 

Attachments

  • Multiple filters.xlsx
    17.9 KB · Views: 3
Back
Top