+ Reply to Thread
Results 1 to 17 of 17

Excel 2007 : Dependent Dropdown (Data Validation)

  1. #1
    Registered User
    Join Date
    05-06-2010
    Location
    marlton nj
    MS-Off Ver
    Excel 2007
    Posts
    7

    Dependent Dropdown (Data Validation)

    Hey everyone, I have a somewhat different question about dependant drop down lists in excel 2007.

    i have been actively searching dependant drop-down menus for excel for 2 days now, and i have not found an example that explains quite what im looking for.

    the problem is that many of these tutorials explain Cascading dependant drop down menus, i.e. 3rd menu dependant on 2nd, 2nd dependant on 1st, almost as if they were in series.

    I need a way to develop a dependant drop down menu that works in parallel, for example, I want to generate a drop down list that is dependant on 3 separate categories simultaneously. each of the 3 categories would be independant of one another and have their own drop down selection. The 4th drop down menu would be specific to each possible combination of the 3 independant categories.

    In case that explination was too general, ill be more specific. I want to generate a list of available wire types based on 3 categories each having their own drop down menu. this is as far as i have gotten:

    1.Run Type (Drop Down):
    ----->1. In Conduit
    ----->2. In Cable Tray

    2.Wire Material (Drop Down):
    ----->1. Copper
    ----->2. Aluminum

    3.Temperature rating (Drop Down):
    ----->1. 60°C (140°F)
    ----->2. 70°C (167°F)
    ----->3. 90°C (194°F)

    The user will select from each of these 3 drop down menus, and will then be able to select from a fourth drop down menu displaying a list of the available wire types according to the specific combination of the 3 categories available. In total, there are 12 specific lists of available wire types based on every possible combination of category 1,2, and 3.

    sorry if this explination is redundant but i wanted to be as specific as possible. I would attatch my file, but it is quite incomplete, and very messy. all i have is the first 3 drop downs, which were relatively easy to learn how to make. thanks in advance for any help.
    much appreciated
    matt
    Last edited by mtpr220; 05-24-2010 at 03:27 PM.

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Question concerning Dependant Drop Down (Data Validation)

    I think you would need to name the tables names that are a concatenation of each possible combination.. then your list formula would be a concatenation.

    So you would have a list named for example:

    InConduitCopper60C140F
    and similar for other lists.

    Then your 4th validation would be something like:

    Please Login or Register  to view this content.
    which replaces the spaces and special characters that are illegal.
    Last edited by NBVC; 05-07-2010 at 07:37 AM.
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Registered User
    Join Date
    05-06-2010
    Location
    marlton nj
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Question concerning Dependant Drop Down (Data Validation)

    thanks nbvc for your quick reply, however i should have been a bit more clear. I just figured out how to do the drop down tables with data validation yesterday, which is fairly straight forward, however, i am a bit unclear as to how the line:

    Please Login or Register  to view this content.
    actually works to point to each individual list i want to display. I was successful in testing the simpler cascading dependant drop down menu tutorials with one dependant menu, but i think im lacking an understanding of how these individual functions work when they are combined for this specific case. i have had no previous exposure to INDIRECT, TRIM, or SUBSTITUTE before, so would you be able to walk me through this line a bit more in depth? as of now i dont really understand what to modify from this code to reference the lists im looking for. I renamed each of the 12 resulting lists as you described above "InConduitCopper60C140F" and so on.

    overall i get that substitute replaces spaces with underscores to avoid errors, and i assume Char refers to the "degree" symbol as an illegal character. indirect is somewhat of a mystery to me though.

    for a1 b1 and c1 i would assume this is in reference to the drop down menus i want to use to determine which list is displayed in the fourth menu, but im having a bit of trouble wrapping my head around howit fgures out which combination of the 3 will display a specific menu in the fourth.

    again, i apologize if this is confusing, im a noob.

    hold that thought, i think i understand it now, give me 15 minutes... *working*
    Last edited by NBVC; 05-07-2010 at 07:37 AM.

  4. #4
    Registered User
    Join Date
    05-06-2010
    Location
    marlton nj
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Dependent Dropdown (Data Validation)

    okay so i spent some time on this after work, and i understand how the code works, so ignore my last post.

    char(176) is °
    trim removes leading and trailing spaces
    substitute just replaces the "(" ")" "°" and " " with ""
    indirect references a range

    so... if i understand correctly,

    make a list for each possible combination of the 3 categories
    concatenate each possible combination from the 3 categories as the reference(range name) for each individual list

    the code is used to recognize the concatenated combination from the 3 categories and then pulls the appropriate list.

    this has worked so far, however. i am now having some trouble with named ranges, i cannot seem to remove the range name from a range i incorrectly named. i was wondering if there is a quick and easy way to highlight the whole set of 12 lists and remove the names to start over. also is there a difference if i changed some of the names from the name box or from the define name tab under formulas?

    and one more thing, i would ideally like the lists of available wire type to be dynamic, so if i want to add additional wire types to a specific list, i dont have to change the named range, it will just add automatically. some of the other dependant drop down tables use the offset function to create a dynamic range, how hard would this be to implement?

    thanks again for your help.

  5. #5
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Dependent Dropdown (Data Validation)

    Check out this link to learn how to create dynamic named ranges:

    http://www.contextures.com/xlNames01.html#Dynamic

    I think the best thing to do is delete the named ranges you don't want one at a time through the Insert|Name|Define dialog. It's the safest bet that you will actually get rid of them

    So I am happy you understand.

    In terms of named ranges, anything non-numeric of text characters is considered illegal (i.e spaces, dashes, symbols, apostrophes, quotes, etc).

    So we need to create ranges that are free of these chars... and because you need to refer to these ranges indirectly, it is best to name them something that you can build from selections you make in the 3 previous dropdown boxes.

    So my formula builds a single string from the combination of selections made in your 3 choices. It then removes all the illegal characters through use of nested Substitute() functions. The resulting string should match a named range exactly and so you can now use INDIRECT to refer to the range and extract the corresponding list for use in your 4th dropdown menu.

    You seem to get the just of it. So I hope you can manage. If not, post what you are having trouble with and I will endeavour to help.

    Good Luck.

  6. #6
    Registered User
    Join Date
    05-06-2010
    Location
    marlton nj
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Dependent Dropdown (Data Validation)

    well i took a break for a few days, but im back at it.

    I have managed to get it to work by deleting/renaming all of my named ranges.

    however, i then tried to implement dynamic ranges for each of the 12 available lists, and i am having difficulty understanding how excel interperets what i am entering.

    with a fixed range, you can simply name the appropriate range for each list and then have the 4th drop down cell recognize which list you want to call out by selecting a combination from the first 3 drop downs.

    however, with the dynamic range i tried implementing the offset function to specify that i want any additional data in the appropriate column to be added to that columns list. if i am thinking correctly the problem with this is that the "fixed" named ranges i defined before are now obsolete because i need them to be dynamic, and instead i need to find a way to offset from a specified cell depending on what combination is chosen from the first 3 drop downs.

    i tried limiting all of my named ranges to just the single top cell for each list and then having the offset function work off of that cell, but so far i am coming up with nothing. i am not sure if i have errors in my syntax or if my method is completely wrong.

    make sense? let me know what you think


    this is what i ended up with for my 4th drop down source, but it obviously doesnt work:

    =offset(INDIRECT(TRIM(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE($A$27&$B$27&$C$27,"(",""),")",""),CHAR(176),"")," ",""))),0,0,counta(INDIRECT(TRIM(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE($A$27&$B$27&$C$27,"(",""),")",""),CHAR(176),"")," ","")))),1)

  7. #7
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Dependent Dropdown (Data Validation)

    The OFFSET function in the Named Range isn't like that...

    It should be a basic formula like:

    =OFFSET(Sheet1!$A$1,0,0,COUNTA(Sheet1!$A:$A),1)

    so here you would create a named range (which is the combination of the 3 previous possible selections).

    e.g. Selection1Selection2Selection3


    Say the range you want that to point to dynamically starts in Sheet1, A1,

    then use the above formula in the Refers to box.

    this will offset from A1 a total number of rows equal to the count of entries made in column A. .... that should be it.

    You would repeat referring to a different column for the next set of selections.

    The whole Indirect(substitute())) thing is for the data validation List formula to create the name of the range it should look up.

  8. #8
    Registered User
    Join Date
    05-06-2010
    Location
    marlton nj
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Dependent Dropdown (Data Validation)

    ohhh ok so in trying the method you just described i thought i was on the right track, but i still seem to be stuck at the 4th drop down again. the first 3 drop downs work perfectly and the code to concatenate these 3 categories works great as well. As you suggested, I have set the 4th data validation source to:

    =INDIRECT(TRIM(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE($A$4&$A$7&$A$10,"(",""),")",""),CHAR(176),"")," ","")))

    where A4, A7, and A10 are the first 3 categories. Next i tested this by naming two distinct ranges using combinations of the 3 categories. The 2 named ranges i tested are as follows

    Name:
    CONDUITCOPPER60C140F

    Value:
    {...}

    Referrs to:
    =OFFSET(LISTS!$D$2,0,0,COUNTA(LISTS!$D:$D)-1,1)


    and


    Name:
    CONDUITCOPPER70C167F

    Value:
    {...}

    Referrs to:
    =OFFSET(LISTS!$E$2,0,0,COUNTA(LISTS!$E:$E)-1,1)

    where the D and E column of sheet "LISTS" are the respective lists for the distinct ccombinations CONDUITCOPPER60C140F and CONDUITCOPPER70C167F. Im not sure why, but the 4th data validation does not seem to recognize these ranges when ther respective combinations are chosen in the first 3 categories. Assuming i interpreted your instructions correctly, this should work shouldnt it?

  9. #9
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Dependent Dropdown (Data Validation)

    I'd have to see what you got so far... can you post a sample workbook?

  10. #10
    Registered User
    Join Date
    05-06-2010
    Location
    marlton nj
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Dependent Dropdown (Data Validation)

    i scrapped my old workbook which was just a bunch of junk and set it up again in the file below. The first sheet is the 4 drop downs, The second sheet ("Lists") is all of the lists for the drop downs. I only incorporated the first 4 lists for the 4th drop down to save time, so as of now the name manager only has the first 3 dropdown sources and the first 4 lists for the 4th drop down. It still reflects the same issue i had above, but should be easier to navigate. let me know if you need anything else.
    Attached Files Attached Files

  11. #11
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Dependent Dropdown (Data Validation)

    First, you were trying to use dynamic name ranges on your Lists sheet, and those don't work with INDIRECT() Data Validation formulas. I have tried and tried in the past to no avail.

    So, the name ranges on the Lists page are now set ranges. That can't be helped, if you need to expand the choices, you will have to adjust the name ranges as well.

    Next, I added a new section to the Lists that will allow you to simply lookup the 3-cell concatenation in one column, and get the name that goes with that list in the second column. That makes the INDIRECT() D.V. formula bit shorter.

    ===========
    I added a new feature as well. If you make a choice in column D of Sheet1, then go back to A:C and make changes in your previous choices, you may make selections that invalidate the answer you already have in column D. If that happens, column D value will light up in red to indicate it needs to be reselected. That's done with Conditional Formatting.
    Attached Files Attached Files
    Last edited by JBeaucaire; 05-24-2010 at 02:13 PM.

  12. #12
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Dependent Dropdown (Data Validation)

    mtpr220,

    I do apologize. JB is correct in that you cannot use dynamic ranges as an indirect refernce in the data validation Lists... I overlooked that rule.

    However, there is a way around it that does allow you to use "dynamic" ranges.

    See attached. I only worked on the CONDUITCOPPER60C140F option....

    The solution is based on the section in this link under title: Using Dynamic Lists

    http://www.contextures.com/xldataval02.html

    So, in your Lists Sheet, go back to redefining the name CONDUITCOPPER60C140F as simply the first cell in the column, ie. Lists!$D$1

    Then add a new name same as above with suffix, Col. I.e. CONDUITCOPPER60C140FCol and define it as Lists!$D$D (ie. the whole column)

    Now your Data Validation list formula is:

    Please Login or Register  to view this content.
    Notice the reference part of the formula is the same as what I had given you before, and it is again used within the COUNTA() part of the formula, with the addition of the concatenation of the suffix "Col".
    Attached Files Attached Files

  13. #13
    Registered User
    Join Date
    05-06-2010
    Location
    marlton nj
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Dependent Dropdown (Data Validation)

    thanks so much to both of you, i think both of these solutions solve my original problem sufficiently. I enjoy the challenge of incorporating more functionality into my spreadsheets, however i obviously have much more to learn (still trying to untangle your conditional formatting JB, it works well, i just need to get a better understanding of the functions so i can figure out how to implement it myself in the future). im far from done so im sure i will be back with more questions, but for now i think this will be sufficient for me to move on.

    thanks again

  14. #14
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Dependent Dropdown (Data Validation)

    Copy the conditional formatting formula out and put it into an empty cell on the same row. CF formulas are by nature TRUE/FALSE tests. If the test resolves to TRUE, the CF is applied.

    While the formula is in a cell, you can use the Formula Auditing toolbar to step through that formula one calc at a time and watch it unfold using the Evaluate Formula icon. Very useful tool.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  15. #15
    Registered User
    Join Date
    12-20-2010
    Location
    St. Paul MN USA
    MS-Off Ver
    Excel 2003,2007
    Posts
    1

    Re: Dependent Dropdown (Data Validation)

    It's Much easier to make a matrix off to the side to refer to the results of the drop down lists name combinations, and the result to return in a column next to the matrix, then the validation will just refer INDIRECT(CE4) or what ever. The key in the matrix is to INDEX(top left to bottom right), Match(""&B1&""&C1&""&D1"",$CB$2:$CB$14),MATCH(top row result column name"Result" top row of matrix $CB$2:$CC$2) and the return value for one of the 12 cominations listed in the column under Column "CB" in Column "CE") This formula goes in Column "CE" and looks up an exact match to serve up to your data validation INDIRECT drop down. By breaking the problem down you are in much better shape for the next issue or change in the demands of your spreadsheet or workbook IMHO.
    Last edited by GusHanson; 12-21-2010 at 04:09 PM.

  16. #16
    Registered User
    Join Date
    08-10-2011
    Location
    usa
    MS-Off Ver
    Excel 2003
    Posts
    2

    Dependent Dropdown (Data Validation)

    I am having trouble getting the drop downs that are dependent on the previous drop-dwon selection to work correctly. I got it to work in a plain excel worksheet, but now im tryign to copy, or add it into an existing worksheet with other data. The firdst title is theme, and the second is category. keeps giving me an error. thanks

  17. #17
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Dependent Dropdown (Data Validation)

    Your post does not comply with Rule 2 of our Forum RULES. Don't post a question in the thread of another member -- start your own thread. If you feel it's particularly relevant, provide a link to the other thread.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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