+ Reply to Thread
Results 1 to 5 of 5

Dependent Drop Down Lists with Lookup in Table Formula

  1. #1
    Registered User
    Join Date
    10-30-2013
    Location
    VA
    MS-Off Ver
    Excel 2003
    Posts
    2

    Dependent Drop Down Lists with Lookup in Table Formula

    Hi all,

    I have a lookup worksheet with two tables like these below:

    Table 1: Unique list of countries with their codes

    Country Country Code
    ------------------------------
    United States US
    United Kingdom UK
    Germany DE

    Table 2: List of cities with their country code, multiple cities per country code

    Country Code City
    ---------------------------
    US New York
    US Chicago
    US Detroit
    UK London
    DE Munich
    DE Dortmund

    I created a drop down (A) with a named range from Table 1 that shows the country names. Now I need to create a dependent drop down (B) that will contain city names based on the selected country. So basically the validation formula for B will need to do a lookup in Table 1 to get the country code for the selected country, do another lookup in Table 2 to get all the cities for the found country code and display them in drop down B.

    Any help will be greatly appreciated!

    Thank you.

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

    Re: Dependent Drop Down Lists with Lookup in Table Formula

    See if anything here gets you where you want to go:

    http://contextures.com/xlDataVal02.html
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  3. #3
    Registered User
    Join Date
    10-30-2013
    Location
    VA
    MS-Off Ver
    Excel 2003
    Posts
    2

    Re: Dependent Drop Down Lists with Lookup in Table Formula

    Not really, I checked that already, the country list is huge with all the countries in the world. It will take forever to create named lists for every country...

  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: Dependent Drop Down Lists with Lookup in Table Formula

    Well, that's what you have to do.

    Maybe you can automate the process using a VBA procedure (macro)?

  5. #5
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: Dependent Drop Down Lists with Lookup in Table Formula

    I worked on this one for the last couple hours, because I like a challenge. Also procrastinating working on real work..

    And I got it to work using some OFFSET and INDIRECT in conjunction with some BigNum LOOKUP to identify the range. This works as long as your 2nd list is sorted by the abbreviation.

    You'll have to change my formula to accommodate for your Column Letter, and for the first row where your data starts. The rest is adapting the ranges.

    I set up another cell, with data validation, list, source:

    =OFFSET(INDIRECT("D"&11+MATCH(VLOOKUP(J3,A12:B14,2,0),D12:D17,0)&":"&"D"&LOOKUP(2,1/(D12:D17=VLOOKUP(J3,A12:B14,2,0)),ROW(D12:D17))),0,1)

    Where D11 was were my 2nd list started

    Hope this works for you

    contingent dropdowns are hard.xlsx


    I'm sure one of the pros here might be able to run with my idea and truncate the expression or write it in a more fluid manner. Essentially the first half the expression is finding the address of the first match and the second half finds the address of the last match. When you select Germany, it looks converts Germany to mean DE, looks up the first and last DE on the 2nd list and outputs the range D16:D17 and then offsets that range to the cities.
    Last edited by daffodil11; 10-30-2013 at 12:31 PM.

+ 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. Dependent drop down lists without creating unique named lists
    By pajordan in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-11-2013, 12:20 PM
  2. [SOLVED] Column B drop down list with 2 options, columns C & E with dependent drop down lists
    By betic in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 09-26-2012, 03:47 PM
  3. Dependent Drop Down Lists
    By rlmtf7 in forum Excel General
    Replies: 1
    Last Post: 08-02-2011, 02:55 AM
  4. Dependent Drop Down lists (multiple drop down)
    By jijy in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-17-2007, 09:56 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