+ Reply to Thread
Results 1 to 9 of 9

Drop Down List with Filter and the Filter list in one single column

  1. #1
    Registered User
    Join Date
    05-14-2008
    Location
    Hong Kong
    MS-Off Ver
    2019
    Posts
    59

    Drop Down List with Filter and the Filter list in one single column

    Hello,

    I need advice on how to create a drop down list where when I select from the Drop down, it will only show the data on the next column based on the drop down list.

    I don't want to have multiple column of data that associate with the drop down list. instead, I wanted to have 2 column of data.

    here is the example:

    When I select the drop down "Country" and I select "USA", in the column, the drop down will show different cities under "USA"
    then, when I press the drop down "Country" and I select "Canada" the drop down will only show different cities under "Canada"

    Can you please advice?

  2. #2
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: Drop Down List with Filter and the Filter list in one single column

    This will tell you what to do. It looks a bit daunting, at first sight.... but persevere!!
    http://www.contextures.com/xlDataVal02.html
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU

  3. #3
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: Drop Down List with Filter and the Filter list in one single column

    This will tell you what to do. It looks a bit daunting, at first sight.... but persevere!!
    http://www.contextures.com/xlDataVal02.html

  4. #4
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Drop Down List with Filter and the Filter list in one single column

    Here's one way...

    Create a 2 column list of the countries and the associated cities...

    Data Range
    A
    B
    1
    All Country
    City
    2
    USA
    Boston
    3
    USA
    New York
    4
    USA
    Pittsburgh
    5
    USA
    Dallas
    6
    Canada
    Toronto
    7
    Canada
    Montreal
    8
    Canada
    Sault Ste Marie
    9
    Canada
    Winnipeg
    10
    England
    London
    11
    England
    Cambridge
    12
    England
    Brighton
    13
    England
    Oxford


    Now, create a list of the unique countries...

    Data Range
    A
    B
    C
    1
    All Country
    City
    Unique Country
    2
    USA
    Boston
    USA
    3
    USA
    New York
    Canada
    4
    USA
    Pittsburgh
    England
    5
    USA
    Dallas
    6
    Canada
    Toronto
    7
    Canada
    Montreal
    8
    Canada
    Sault Ste Marie
    9
    Canada
    Winnipeg
    10
    England
    London
    11
    England
    Cambridge
    12
    England
    Brighton
    13
    England
    Oxford


    This array formula** entered in C2:

    =IFERROR(INDEX(A$2:A$13,MATCH(0,COUNTIF(C$1:C1,A$2:A$13),0)),"")

    ** array formulas need to be entered using the key
    combination of CTRL,SHIFT,ENTER (not just ENTER).
    Hold down both the CTRL key and the SHIFT key
    then hit ENTER.

    Copy down until you get blanks.

    Then, as the source for the country drop down list use this formula:

    =OFFSET(C2,,,COUNTIF(C2:C100,"?*"))

    Let's assume that drop down list is in cell F2.

    As the source for the city drop down list use this formula:

    =OFFSET(A2,MATCH(F2,A2:A13,0)-1,1,COUNTIF(A2:A13,F2))

    Here's a sample file that demonstrates this...
    Attached Files Attached Files
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  5. #5
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2502
    Posts
    13,700

    Re: Drop Down List with Filter and the Filter list in one single column

    That is way cool, Tony.

    I've always tried INDEX / MATCH for my dynamic ranges in drop downs. Of course they don't work.

    Thanks for this. It's in my "Keeper" file, now.

    Rep added.
    Dave

  6. #6
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Drop Down List with Filter and the Filter list in one single column

    Thanks!

  7. #7
    Registered User
    Join Date
    05-14-2008
    Location
    Hong Kong
    MS-Off Ver
    2019
    Posts
    59

    Re: Drop Down List with Filter and the Filter list in one single column

    Thank you so much - this is really good !!!

  8. #8
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Drop Down List with Filter and the Filter list in one single column

    You're welcome. Thanks for the feedback!

  9. #9
    Registered User
    Join Date
    05-14-2008
    Location
    Hong Kong
    MS-Off Ver
    2019
    Posts
    59

    Re: Drop Down List with Filter and the Filter list in one single column

    Hi Tony,

    it was good, but I like to ask one more question, for all country, what if, it is not sorted? what is the formula?

    cheers
    Raymond

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. How to replace drop down list filter to those normal excel filter?
    By cks1026 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-24-2016, 02:48 AM
  2. Replies: 5
    Last Post: 03-02-2015, 02:32 PM
  3. Dynamic Drop down list based on a column filter
    By robertfu in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-09-2014, 05:57 AM
  4. Replies: 0
    Last Post: 01-16-2014, 10:55 AM
  5. [SOLVED] Filter using drop down list
    By DawsonG in forum Excel General
    Replies: 8
    Last Post: 03-26-2013, 11:20 AM
  6. Synchronisation of Validation list of one cell with filter list of other column
    By ac1989 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-31-2012, 05:19 AM
  7. Drop-down list & filter
    By Jenkkipurkka in forum Excel General
    Replies: 2
    Last Post: 03-16-2010, 01:55 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1