View Single Post
  #5   Report Post  
Tim Paine Tim Paine is offline
Junior Member
 
Posts: 27
Default how to create a dynamic drop down list in excel

To create a dynamic dependent drop down list in Excel, carry out these steps:

1. Get items for the main drop down list
For starters, we shall extract all different fruit names from column A. This can be done by using the UNIQUE function in its simplest form - supply the fruit list for the first argument (array) and omit the remaining optional arguments as their defaults work just fine for us:
2. Create the main drop down
To make your primary drop-down list, configure an Excel Data Validation rule in this way:

Select a cell in which you want the dropdown to appear (D3 in our case).
On the Data tab, in the Data Tools group, click Data Validation.
In the Data Validation dialog box, do the following:
Under Allow, select List.
In the Source box, enter the reference to the spill range output by the UNIQUE formula. For this, type the hash tag right after the cell reference, like this: =$G$3#
This is called a spill range reference, and this syntax refers to the entire range regardless of how much it expands or contracts.

Click OK to close the dialog.
Get items for the dependent drop down list
To get entries for the secondary dropdown menu, we'll filter the values in column B based on the value selected in the first dropdown. This can be done with the help of another dynamic array function called FILTER:

=FILTER(B3:B15, A3:A15=D3)

Where B3:B15 are the source data for your dependent drop down, A3:A15 are the source data for your main dropdown, and D3 is the main dropdown cell.

To make sure the formula works correctly, you can select some value in the first drop-down list and observe the results returned by FILTER. Make the dependent drop down
To create the second dropdown list, configure the data validation criteria exactly as you did for the first drop down at step 2.

I hope this helps!
Tim Paine