+ Reply to Thread
Results 1 to 6 of 6

VLOOKUP & Dynamic drop down lists

  1. #1
    Registered User
    Join Date
    12-05-2014
    Location
    canada
    MS-Off Ver
    2010
    Posts
    4

    VLOOKUP & Dynamic drop down lists

    Hello all,

    After searching like crazy, I am stuck as to how to create a dynamic drop down list using VLOOKUP.

    In one workbook:
    - I have an input worksheet where employees enter their data and the data gets transferred to a master-list via button (macro). Every employee row in the master-list has their manager's ID "linked" (via an org list and VLOOKUP)
    - As a manager, there is a separate manager worksheet that a) validates the manager's ID and b) builds the drop down list of their team only (this is where I get into some trouble).


    Is there a way to build the drop down list in the manager worksheet that's based on the managers ID, matched to the data that is in the master-list?

    Please help!

  2. #2
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Re: VLOOKUP & Dynamic drop down lists

    Here's an approch that uses:
    Excel Tables
    Calculated Name

    It's actually easier that the instructions might imply
    (I'd attach a file, but my company firewall doesn't allow it)

    In this example, there are 2 tabs
    - MgrSheet
    - Lists

    On the lists tab, I created this list in A1:D13
    Please Login or Register  to view this content.
    • Select that list
    • Home.Format-as-table...Select a style...follow the prompts
    • From the TableTools ribbon tab, rename the table to: tblMgrTeam

    • Enter this formula in the first cell under the Start heading (C2)
    Please Login or Register  to view this content.
    • Enter this formula in the first cell under the Count heading (D2)
    =IF(tblMgrTeam[[#This Row],[Start]]<>"",COUNTIF([Mgr],tblMgrTeam[[#This Row],[Mgr]]),"")

    After Excel automatically propagates those formulas down the table rows, the table will have these values:
    Please Login or Register  to view this content.
    Now...on the MgrSheet tab
    A1: the name of a manager (as it appears in the tblMgrTeam table)...Dave

    • Formulas.Name_Manager...Click: New
    Name: MgrTeamList
    Refers to:
    Please Login or Register  to view this content.
    ...Click: OK

    Create a data validation on cell A2
    • Data.Validation.Validation
    Allow: List
    Source: =MgrTeamList
    ...Click: OK

    Now, whenever the mgr name changes in A1, the name "MgrTeamList" fomrula will find that name in the tblMgrTeam and create a list of team members for that manager. That list will appear in the data validation dropdown.

    You could also attach some event code to the manager name that clears the dropdown selection whenever the manager name changes.

    Is that something you can work with?
    Ron
    Former Microsoft MVP - Excel (2006 - 2015)
    Click here to see the Forum Rules

  3. #3
    Registered User
    Join Date
    12-05-2014
    Location
    canada
    MS-Off Ver
    2010
    Posts
    4

    Re: VLOOKUP & Dynamic drop down lists

    Hi Ron,

    This is *almost* the result I'm looking for!

    Since the data in the master-list isn't group via manager name, I don't achieve the desired result.

    As an example, the below is a sample of my data in the master-list:

    chart.jpg

    Please advise.

    Thank you!
    Last edited by PNY80; 05-20-2015 at 07:04 PM. Reason: text formatting

  4. #4
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Re: VLOOKUP & Dynamic drop down lists

    A list like that is less than ideal as the source for data validation lists.

    But, if that's what you intend to use....
    • I created a tab named "Analysis"
    ...A1: a manager name...Manager 2

    • I put your list in a tab named "Data", beginning in cell A1 (and assuming the headings (Manager Name, etc) are on Row_1)

    • I created a tab named "Lists"
    On that tab
    • A1: Team
    • Select A1:A14 and Home.Format-as-table...follow the prompts.
    • Rename that table to "tblMgrTeam"....Table_Tools.Design.Table_Name
    • Enter this ARRAY FORMULA, completed by holding down CTRL and SHIFT when you press ENTER (instead of just pressing ENTER) in A2
    Please Login or Register  to view this content.
    ...Excel will propagate that formula down the table rows

    • Formulas.Name_Manager...Click: New
    Name: MgrTeamList
    Refers to:
    Please Login or Register  to view this content.
    ...Click: OK

    On the An tab, create a data validation on cell A2
    • Data.Validation.Validation
    Allow: List
    Source: =MgrTeamList
    ...Click: OK

    Now, whenever the mgr name changes in A1, the name "MgrTeamList" formula will find create a list of team members for that manager.
    That list will appear in the data validation dropdown.

    Does that help?

  5. #5
    Registered User
    Join Date
    12-05-2014
    Location
    canada
    MS-Off Ver
    2010
    Posts
    4

    Re: VLOOKUP & Dynamic drop down lists

    Hi Tom,

    This works! However, because my data is added ad-hoc, ie/ my manager team list isn't always at a final stage, my data includes #N/A's (because the employee name is matched to their manager name via VLOOKUP), and therefore, the INDEX formula doesn't recognize these items and the drop-down doesn't get built.

    Is there a way for the drop down lists to get built even when my data has #N/A's?

    Please advise!

  6. #6
    Registered User
    Join Date
    12-05-2014
    Location
    canada
    MS-Off Ver
    2010
    Posts
    4

    Re: VLOOKUP & Dynamic drop down lists

    Quote Originally Posted by PNY80 View Post
    Hi Tom,

    This works! However, because my data is added ad-hoc, ie/ my manager team list isn't always at a final stage, my data includes #N/A's (because the employee name is matched to their manager name via VLOOKUP), and therefore, the INDEX formula doesn't recognize these items and the drop-down doesn't get built.

    Is there a way for the drop down lists to get built even when my data has #N/A's?

    Please advise!
    Hi Tom - I figured out that by wrapping my VLOOKUP with an IFERROR, the #N/A's are removed and the drop downs operate as expected.

    Thanks SO MUCH for your assistance in helping me build my drop downs. It is greatly appreciated!!!

+ 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. Drop down box using data from dynamic lists
    By guerrilla_gorrila in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 12-06-2014, 08:25 PM
  2. Dynamic Drop Down lists
    By Excellearnerva in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 04-25-2014, 10:20 AM
  3. [SOLVED] Dynamic Ranges as drop down lists based on another drop down list
    By Excel_Beginner_1 in forum Excel General
    Replies: 4
    Last Post: 05-15-2012, 03:31 PM
  4. Dependent and dynamic drop-down lists
    By csunseri in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-24-2011, 04:32 AM
  5. Dynamic suggestion drop down lists
    By wesmortimer in forum Excel General
    Replies: 3
    Last Post: 10-27-2010, 12:25 PM

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