Dynamic drop-down lists

bradams

New Member
Joined
Oct 23, 2012
Messages
40
I need to create a drop-down list where the options depend on the value selected in another drop-down list. I used to do this regularly but it has been at least 10 years. Of course, there are probably easier ways to do it now. The way I remember doing it had something to do with the items in the first drop-down being indexed. In the attached image, the user will choose an Opportunity (A, B, C, D or E) in a drop-down in cell D1. That choice would dictate what options for items would be available in the 2nd drop-down in cell D2. As you can see, the number of items will vary by opportunity. Thanks in advance for any help you can provide.
 

Attachments

  • Dynamic Drop-down List.png
    Dynamic Drop-down List.png
    12.9 KB · Views: 32

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
Suggestion: create Name Ranges for each of the Opportunities (e.g., Alist for the As; Blist for the Bs)
Then, in your dependent drop down in D2, make the list selection: =INDIRECT(D1&"list")
 
Upvote 0
Suggestion: create Name Ranges for each of the Opportunities (e.g., Alist for the As; Blist for the Bs)
Then, in your dependent drop down in D2, make the list selection: =INDIRECT(D1&"list")

Sorry, I guess I didn't think through my example all the way. The opportunity name won't be incorporated into the item names. Also, the list of opportunities and items will constantly be changing so I couldn't easily define name ranges.
 
Upvote 0
As far as my experience goes, I think the whole idea of dependent drop downs is based on name ranges.
 
Upvote 0
Hi Bradams,

You can manufacture your dropdown lists from the data then offer them as the dropdown. To avoid lots of blank spaces from unused cells you can also manufacture a reference to the beginning and end of each dropdown then use INDIRECT to only offer those options.
I see you've said there's no content relationship between Opportunity and Item so for Items I've used random words from Shakespeare's "As You Like It".

Bradams.xlsx
ABCDEFGH
1OpportunityItemSelect OpportunityD$G$3:$G$6$H$3:$H$8
2AanswerdSelect ItemmatronOpportunity DropdownItem Dropdown
3AcardinalAlittle
4AcounterfeitBmatron
5AcranksCneedy
6AdistributionDobedience
7Afair plague
8Bharry poverty
9Bhollow  
10Binfinite  
11Cking  
12Clead  
13Dlittle  
14Dmatron  
15Dneedy  
16Dobedience  
17Dplague  
18Dpoverty  
Sheet1
Cell Formulas
RangeFormula
G1G1=ADDRESS(ROW($G$3),COLUMN($G$1))&":"&ADDRESS(COUNTIF($G$3:$G$20,"> ")+ROW($G$2),COLUMN($G$3))
H1H1=ADDRESS(ROW($H$3),COLUMN($H$1))&":"&ADDRESS(COUNTIF($H$3:$H$20,"> ")+ROW($H$2),COLUMN($H$3))
G3:G18G3=INDEX($A$2:$A$9999,MATCH(0,INDEX(COUNTIF($G$2:$G2,$A$2:$A$9999),),0))&""
H3:H18H3=IFERROR(INDEX($B$2:$B$9999,AGGREGATE(15,6,ROW($A$2:$A$9999)-ROW($A$1)/($A$2:$A$9999=$E$1),ROW()-ROW($H$2))),"")
Cells with Data Validation
CellAllowCriteria
E1List=INDIRECT($G$1)
E2List=INDIRECT($H$1)
 
Upvote 0
Thank you for putting this together for me! It appears to work but I'm still trying to understand exactly how it works. I'm going to keep working on it tomorrow at the office because it will be easier with dual monitors. For now, I just wanted to say thank you. I may have some more questions tomorrow.
 
Upvote 0
Toadstool: beautiful solution to creating the options for the drop downs!!
Would it be save to use UNIQUE(A2:A18) in G3 if running 365?
 
Upvote 0
Toadstool: beautiful solution to creating the options for the drop downs!!
Would it be save to use UNIQUE(A2:A18) in G3 if running 365?
Thanks!
While I'd like to use UNIQUE and SORT I find most of my Customers are on 2013 or 2016 so I'm staying with 2016 for now... but that means I can't answer your question with any kind of confidence.

btw, I like the constructed range approach for the Data Validation List as it gives a visual confirmation of what list will be used with INDIRECT, but you can also use a similar approach with OFFSET.

Bradams.xlsx
ABCDEFGH
1OpportunityItemSelect OpportunityDOpportunity DropdownItem Dropdown
2AanswerdSelect ItemmatronAlittle
3AcardinalBmatron
4AcounterfeitCneedy
5AcranksDobedience
6Adistribution plague
7Afair poverty
8Bharry  
9Bhollow  
10Binfinite  
11Cking  
12Clead  
13Dlittle  
14Dmatron  
15Dneedy  
16Dobedience  
17Dplague  
18Dpoverty  
19  
20  
WithOffset
Cell Formulas
RangeFormula
G2:G20G2=INDEX($A$2:$A$9999,MATCH(0,INDEX(COUNTIF($G$1:$G1,$A$2:$A$9999),),0))&""
H2:H20H2=IFERROR(INDEX($B$2:$B$9999,AGGREGATE(15,6,ROW($A$2:$A$9999)-ROW($A$1)/($A$2:$A$9999=$E$1),ROW()-ROW($H$1))),"")
Cells with Data Validation
CellAllowCriteria
E1List=OFFSET($G$2,,,COUNTIF($G$2:$G$20,"> "))
E2List=OFFSET($H$2,,,COUNTIF($H$2:$H$20,"> "))
 
Upvote 0

Forum statistics

Threads
1,221,526
Messages
6,160,340
Members
451,637
Latest member
hvp2262

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top