+ Reply to Thread
Results 1 to 6 of 6

Drop down list dependent on the result from another.

  1. #1
    Registered User
    Join Date
    11-12-2017
    Location
    Stafford, England
    MS-Off Ver
    365
    Posts
    184

    Drop down list dependent on the result from another.

    Hi,

    I have tried solving this myself for a couple days now, tried tables, pivot tables, range names, unique lists... just can't work it out.

    In the attached sample, I would like a unique drop down list in 'Employees!C2' based in the data 'Directory!A:A.
    I did achieve this by adding column 'Directory!D:D' with formula copied down:

    {=IFERROR(INDEX('Sample.xlsm'!Area, MATCH(0,COUNTIF($A$1:D1, 'Sample.xlsm'!Area), 0)),"")}

    What i required next and where the problem lies is in 'Employees!F2', I need a drop down list from all the store codes in 'Directory!B:B' that correspond to the number selected in 'Employees!C2' that matches 'Directory!A:A'.

    A lot of data has been removed for security reasons but this will then later be used to reference the store name in 'Directory!C:C' that matches the store code selected in 'Employees!F2'

    I trust all that makes sense lol.

    Tez
    Attached Files Attached Files

  2. #2
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: Drop down list dependent on the result from another.

    Think this is what you want. It involves a couple of pivot tables on the Directory Sheet. The first one is a unique list of Areas. the second is the list of store codes for a selected area.

    The results of both pivot tables are overlaid with a named dynamic range. See this wiki for more information: http://www.utteraccess.com/wiki/Offs...Dynamic_Ranges. These ranges are used for the data validation.

    A small bit of VB Code (Sheet Change Event), sets the pivot filter to the selection in Cell C2.
    Attached Files Attached Files
    One spreadsheet to rule them all. One spreadsheet to find them. One spreadsheet to bring them all and at corporate, bind them.

    A picture is worth a thousand words, but a sample spreadsheet is more likely to be worked on.

  3. #3
    Registered User
    Join Date
    11-12-2017
    Location
    Stafford, England
    MS-Off Ver
    365
    Posts
    184

    Re: Drop down list dependent on the result from another.

    Works great, Thanks!!

    I knew there would be tables involved but just couldn't figure out how to put it all together.

    Looked at many website that just confused me

    Thanks

  4. #4
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: Drop down list dependent on the result from another.

    I'll explain the named range using one of the names in the workbook.

    The offset command has five arguments:
    - A starting Cell
    - Number of rows to go down
    - Number of columns to go right
    - Number of rows to return
    - Number of columns to return

    One of the names as defined in Formulas -> Name Manager is: Code_List =OFFSET(Directory!$H$4,0,0,COUNTA(Directory!$H:$H)-2,1)

    This means
    - Start in Cell H4
    - go down zero rows
    - go right zero columns
    - give me a range COUNTA(H:H)-2 rows deep and one column wide.

    The reason for the -2 is that we literally don't want to "count" the cells occupied by the pivot filter heading and the pivot row heading.

  5. #5
    Forum Contributor
    Join Date
    03-29-2013
    Location
    lakewood, usa
    MS-Off Ver
    exce2013
    Posts
    112

    Re: Drop down list dependent on the result from another.

    Here is a solution that doesn't use tables or VBA.
    realize it is a little late but give it a try
    Column E is a list of the area codes. Column G is a named variable "selected".
    the store codes for an area are listed by the following formula in G2 and copied down.

    IFERROR(INDEX(B$2:B$999,AGGREGATE(15,6,(ROW(Area)-ROW($A$2)+1)/(Area=Employees!$C$2),ROWS(G$2:G2))),"")
    On the employee sheet the are code drop down source is column E.
    The store cod drop down list source is the "selected list.
    This should work if the are codes are not grouped or not is sequence.

    It is all Purple Smoke & Mirrors.
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    11-12-2017
    Location
    Stafford, England
    MS-Off Ver
    365
    Posts
    184

    Re: Drop down list dependent on the result from another.

    Thanks

    Its always good to see how things work and see other ways of getting results.

+ 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. [SOLVED] Clear up to three dependent drop down lists based on selection in superior drop down list
    By theletterh in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 03-04-2016, 09:31 PM
  2. Dependent Drop Down list to autofill next drop down with selective choices
    By MitchellHydro1 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-08-2015, 01:18 PM
  3. [SOLVED] Dependent Drop down list with DEPENDENT DEFAULT VALUE
    By ginieman in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 10-28-2013, 03:56 AM
  4. [SOLVED] Suppress drop-down list dependent on value chosen in another drop-down list
    By ptmald in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-17-2013, 07:17 PM
  5. Validation list (dependent on the result of the preceding list) + Concatenate
    By Elainefish in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 04-08-2013, 09:19 AM
  6. [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
  7. [SOLVED] Dependent Drop down list with DEPENDENT DEFAULT VALUE (e.g. Blank)
    By Waqar Ali in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 04-26-2012, 06:31 AM

Tags for this Thread

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