Create dependent drop down lists containing unique distinct values in excel
Here is a list of order numbers and products.
We are going to create two drop down lists.
The first drop down list contains unique distinct values from column A.
The second drop down list contains unique distinct values from column B, based on chosen value in the first drop down list.
Create a dynamic named range
- Click "Formulas" tab
- Click "Name Manager"
- Click "New..."
- Type a name. I named it "order". (See attached file at the end of this post)
- Type =OFFSET(Sheet1!$A$2,0,0,COUNTA(Sheet1!$A$2:$A$1000)) in "Refers to:" field.
- Click "Close" button
Create a unique distinct list from column A
- Select Sheet2
- Select cell A2
- Type "=INDEX(order,MATCH(0,COUNTIF($A$1:A1,order),0))" + CTRL + SHIFT + ENTER
- Copy cell A2 and paste it down as far as needed.
Create a dynamic named range to get unique distinct list
- Select Sheet2
- Click "Formulas" tab
- Click "Name Manager"
- Click "New..."
- Type a name. I named it "uniqueorder". (See attached file at the end of this post)
- Type =OFFSET(Sheet2!$A$2, 0, 0, COUNT(IF(Sheet2!$A$2:$A$1000="", "", 1)), 1) in "Refers to:" field.
- Click "Close" button
Create drop down list
- Select Sheet1
- Select cell D2
- Click Data tab
- Click Data validation button
- Click "Data validation..."
- Select List in the "Allow:" window.
- Type =uniqueorder in the "Source:" window
- Click OK!
Here is a picture of what we have accomplished so far.
How to create a secondary unique list based on only one chosen cell value in first drop down list
Create a dynamic named range
- Click "Formulas" tab
- Click "Name Manager"
- Click "New..."
- Type a name. I named it "product". (See attached file at the end of this post)
- Type =OFFSET(Sheet1!$B$2,0,0,COUNTA(Sheet1!$B$2:$B$1000)) in "Refers to:" field.
- Click "Close" button
Create a unique distinct list from column B
- Select Sheet2
- Select cell B2
- Type "=INDEX(product, MATCH(0, COUNTIF($B$1:B1, product)+(order<>Sheet1!$D$2), 0))" + CTRL + SHIFT + ENTER
- Copy cell B2 and paste it down as far as needed.
Create a dynamic named range to get unique distinct list
- Select Sheet2
- Click "Formulas" tab
- Click "Name Manager"
- Click "New..."
- Type a name. I named it "uniqueproduct". (See attached file at the end of this post)
- Type =OFFSET(Sheet2!$B$2, 0, 0, COUNT(IF(Sheet2!$B$2:$B$1000="", "", 1)), 1) in "Refers to:" field.
- Click "Close" button
Create drop down list
- Select Sheet1
- Select cell D5
- Click Data tab
- Click Data validation button
- Click "Data validation..."
- Select List in the "Allow:" window.
- Type =uniqueproduct in the "Source:" window
- Click OK!
Download example workbook
unique distinct dependent lists.xls
(Excel 97-2003 Workbook *.xls)
Download example workbook with a third column of data
unique-distinct-dependent-lists1 three columns.xls
(Excel 97-2003 Workbook *.xls)
Related article:
Create a drop down list containing only unique distinct alphabetically sorted text values using excel array formula
Functions in this article:
IF(logical_test;[value_if:true];[value_if_false])
Checks whether a condition is met, and returns one value if TRUE, and another value if FALSE
INDEX(array,row_num,[column_num])
Returns a value or reference of the cell at the intersection of a particular row and column, in a given range
COUNT(value1;[value2])
Counts the number of cells in a range that contain numbers
OFFSET(reference,rows,cols, [height],[width])
Returns a reference to a range that is a given number of rows and columns from a given reference
MATCH(lookup_value;lookup_array; [match_type])
Returns the relative position of an item in an array that matches a specified value
COUNTIF(range,criteria)
Counts the number of cells within a range that meet the given condition
COUNTA(value1,[value2],)
Counts the number of cells in a range that are not empty
Dependent Drop Down Lists AddIn
Dependent drop down lists is an AddIn for Excel 2007/2010 that let´s you easily create drop down lists (comboboxes, form controls) in Microsoft® Excel.
What are dependent drop down lists?
A dependent drop down list changes it´s values automatically depending on selected values in previous drop down lists on the same row.
Example (Click to expand)The first drop down list in the picture above contains values from "Region" column. The second drop down list contains values from "Country" column and the third from City column.
Now depending on the selected value in the first drop down list, the second and third drop down lists change their values automatically.
In the picture above, the first drop down list has the value "Europe" selected, the second "France and in the third you can choose between "Lyon" or "Paris". You can see how the columns are related to each other if you examine the table above.
Features
- Utilizes a pivot table to quickly filter and sort values for maximum speed
- The drop down lists are populated using Visual Basic for Applications
- No excel formulas
- You can create as many drop down lists you want
- You can send workbooks containing dependent drop down lists to friends, colleagues etc, as long as they can open macro-enabled workbooks.
For simplicity, your data set must be an excel table. That is easily created if you don´t know how. A vba macro is required in your workbook. The AddIn shows you how in a few simple steps.
How to use the AddIn (Click to expand)
Questions
Is there a money back guarantee?
Sure, you have un-conditional money back guarantee for 14 days.
Why form controls?
A form control may have a macro assigned that runs when a new value is selected. This makes it possible to manipulate all drop down lists with a single macro.
Why a pivot table?
A pivot table filters and sorts values extremly quickly. Of course, it is possible to filter and sort values using vba but working with large data sets, a pivot table rules when it comes to speed!
Do the excel table, pivot table and the drop down lists have to be on the same sheet?
No, but they must be in the same workbook.
What customizations can I do with a combobox (form control)?
You can change the number of drop down lines, 3d effects and link each drop down list to a single cell.
Can I hide the pivot table sheet?
Yes! Right click on the sheet and click on "Hide"
Can I change the order of drop down lists?
Yes, rearrange the table columns and then use the AddIn to create drop down lists.
How the Purchase Process Works?
- Payment is accepted via PayPal.
- After you finish payment, you are redirected to the download page. You will also receive an email with the download link.
- You have five attempts to download the file.
- The download link will expire in 120 hours (5 days).
If you can´t downloading the file, contact me.
Related blog posts
- Create dependent drop down lists containing unique distinct values in multiple rows
- Dependent drop down lists – Enable/Disable selection filter
- Invoice template with dependent drop down lists in excel
- Private: Dependent Drop Down lists AddIn
- Create a drop down list containing alphabetically sorted values in excel





















July 19th, 2010 at 8:41 am
finally!
but attached file is empty?
July 19th, 2010 at 8:51 am
david,
A new excel file is attached!
Thanks for commenting!
July 19th, 2010 at 9:18 am
works great and marvellous work!
thansk!
October 15th, 2010 at 8:57 pm
this process works to perfection! thanks so much for posting. now if i only knew how to apply these dropdown selections to a filter, i'd be set.
October 28th, 2010 at 12:21 pm
Josh,
read this post: Apply dependent combo box selections to a filter in excel 2007
November 3rd, 2010 at 9:20 pm
I just came across your site as I was looking to do this very thing, (with a slight twist). I am setting up a sheet where the same type of dynamic lists were needed for multiple entries. I.e. I needed to be able to make an entry in one column from a drop down list and have a dependant list on the same line in the next column, THEN have the dependant list update based on the new entry on the next line. Using you list formulas and adding a very slight modification I am able to implement the dynamic drops lists I needed. Thanks very much!
November 11th, 2010 at 2:09 am
how would i make this also be alphabetical?
November 11th, 2010 at 11:09 am
Fantastic!
November 11th, 2010 at 11:48 am
jon,
Sheet2:
Array formula in cell A2:
=INDEX(order, MATCH(SMALL(IF(COUNTIF($A$1:A1, order)=0, COUNTIF(order, "< "&order), ""), 1), IF(COUNTIF($A$1:A1, order)=0, COUNTIF(order, "<"&order), ""), 0)) + CTRL + SHIFT + ENTER. Copy cell A2 and paste it down.
Array formula in cell B2:
=INDEX(product, MATCH(SMALL(IF((COUNTIF($C$1:C1, product)+(order<>Sheet1!$D$2))=0, COUNTIF(product, "< "&product), ""), 1), IF((COUNTIF($C$1:C1, product)+(order<>Sheet1!$D$2))=0, COUNTIF(product, "<"&product), ""), 0)) + CTRL + SHIFT + ENTER. Copy cell B2 and paste it down as far as needed.
November 11th, 2010 at 12:37 pm
Hi,
I tried to use this formula, but the unique values some how are giving duplicate values for me.
November 11th, 2010 at 8:08 pm
Sharmila,
Did you change the relative and absolute cell references (bolded) in both formulas?
=INDEX(order,MATCH(0,COUNTIF($A$1:A1,order),0))
=INDEX(product, MATCH(0, COUNTIF($B$1:B1, product)+(order<>Sheet1!$D$2), 0))
November 12th, 2010 at 1:26 am
Oscar,
thanks for the reply. i entered the formula into A2 and that worked but the formula for B2 didnt work. i was wondering maybe it was becasue the formula referenced "$c$1:c1" so i changed it to reference "$b$1:b1" since i was entering the formula into B2 but that didnt work either. any advice?
thanks in advance.
November 12th, 2010 at 3:03 am
figured it out. it had to do with the $C$1:C1 as i guessed as well as all the spaces in the formula. i took out the spaces and it worked perfect.
thanks! great formula!
November 12th, 2010 at 11:41 am
I am happy you figured it out!
November 15th, 2010 at 9:17 am
Hi,
I have a question, how can i use these list for multiple rows?
I would like to use these lists for multiple rows and let people enter detailed records.
November 16th, 2010 at 1:49 pm
The answer to Sharmilas question can be found here: Create dependent drop down lists containing unique distinct values in multiple rows
December 25th, 2010 at 4:42 pm
Hi,
Would there be any changes in the formula if Product in the first column and Order#ID in the second column?
Thanks
sanlen
December 27th, 2010 at 3:33 pm
sanlen,
No, the formulas work with both numbers or text.
January 10th, 2011 at 8:14 am
Hey, thanks for this wonderful information.
I need one more addition. How can i make it generic, instead of copying the cell & pasting it all the way down?
January 10th, 2011 at 10:09 am
Suraj,
I am not sure I understand.
Try this formula in A2 and cells down:
=INDEX(order, SMALL(IF(MATCH(order, order, 0)=(ROW(order)-MIN(ROW(order))+1), ROW(order)-MIN(ROW(order))+1), ROW()-1)) + CTRL + SHIFT + ENTER
Array formula in B2 and cells down:
=INDEX(product, SMALL(IF(IF(ISERROR(MATCH(IF(order=Sheet1!$D$2, product, FALSE), IF(order=Sheet1!$D$2, product, ""), 0)), "", MATCH(IF(order=Sheet1!$D$2, product, FALSE), IF(order=Sheet1!$D$2, product, ""), 0))=(ROW(product)-MIN(ROW(product))+1), ROW(product)-MIN(ROW(product))+1), ROW()-1)) + CTRL + SHIFT + ENTER
January 12th, 2011 at 11:51 pm
Oscar,
I am trying to do this on multiple columns?
Crop Select SF/ST Qty
ARA PLANTS UNTREATED 1 PLANT
ARA SEEDS STANDARD TREATMENT 1 SDS
ARA SEEDS UNTREATED 10 SDS
ARA 100 SDS
ASA 1 SDS
ASA 10 SDS
ASA 50 SDS
BDB SEEDS ITALIAN TREATMENT 20 KG
BDB SEEDS LORSB./THIR/APR. 25 KG
BDB SEEDS STANDARD TREATMENT 25 SDS
BDB SEEDS UNTREATED 5 KG
BDB 5 SDS
BNC SEEDS ITALIAN TREATMENT 0,100 KG
BNC SEEDS LORSB./THIR/APR. 0,250 KG
BNC SEEDS STANDARD TREATMEN 1 KG
BNC SEEDS UNTREATED 1 SDS
BNC 250 SDS
The column 2 and 3 are independant of each other but dependent on the first column
January 13th, 2011 at 9:37 am
Deb,
I think you need to read this article: http://www.get-digital-help.com/2010/11/16/create-dependent-drop-down-lists-containing-unique-distinct-values-in-multiple-rows/
You can then apply dependent drop down lists on multiple rows.
January 18th, 2011 at 8:05 am
Oscar,
I meant to say:
Instead of copying cell A2 & B2 all the way down in Sheet2, is there a generic way of doing that? Can the formula be automated, so as to avoid #N/A in the cells on Sheet2?
January 18th, 2011 at 8:48 am
Suraj,
#N/A´s are avoided by using a dynamic named range and are not displayed in any of the drop down lists.
=OFFSET(Sheet2!$A$2, 0, 0, COUNT(IF(Sheet2!$A$2:$A$1000="", "", 1)), 1).
IFERROR() function prevents error messages in cells.
January 18th, 2011 at 9:41 am
Oscar,
Thanks a lot. I would rather hide the calculation sheet(Sheet2), than to try and hide/manipulate the #N/A values.
Anyways, Great Work. Keep it up!
It helped me a lot.
January 18th, 2011 at 11:59 pm
Hi,
I am trying to filter values in a drop down menu based on the values entered in the previous drop down menu.
eg: i have values 1,2,3,4,etc in drop down cell 1.
i want to filter values in drop down cell which contains 111,222,22,333,444,etc..
If I enter 2 in cell 1 then the second cell should filter values and show only 222 and 22...
Thanks in advance...
Amit
January 19th, 2011 at 10:16 pm
Amit,
Instead of creating unique distinct values you need to filter values.
try formula:
=INDEX(array, SMALL(IF(ISERROR(SEARCH($H$3, array)), "", ROW(array)-MIN(ROW(array))+1), ROW(A1))) + CTRL + SHIFT + ENTER
Adjust cell references and named ranges to your sheet.
February 3rd, 2011 at 2:24 pm
Its working very well...........but i want it like this
on click of an alphabet its should move to the the corresponding list
February 3rd, 2011 at 3:03 pm
Its working very well...........but i want it like this
on click of an alphabet its should move to the the corresponding list
if any alphabet is entered it should get all list corresponding to that alphabet
February 3rd, 2011 at 9:51 pm
Shikhar,
can you elaborate? Can you provide an example?
February 4th, 2011 at 6:18 am
For Eg:-i have created a sheet named list
it has 5 columns
1st column contains:4 project types development,documentation,maintainence,lotus notes
2nd column contains:all the development projects
3rd column contains:-all the documentation projects
4th column contains:-maintainence projects
5th column contains:-lotus notes projects
I have put a validation on some other sheets so that according to the project types the projects are coming and the user can select his particular choice.
Till here its working fine
But if a user is pressing any alphabet say "A" I want is that the control should go to the project starting with A........
@ oscar thanks for replying me and if possible get some alternative for this......
February 4th, 2011 at 12:46 pm
shikhar,
Predictive text is possible in combo boxes (ActiveX) with some programming.
See Contextures: Excel Data Validation Combo box using Named Ranges
February 6th, 2011 at 11:58 pm
Hi Oscar,
Thank you for the wonderful solution.
I am attempting to recreate what you have done in Excel 2007. I seem to be having issues with the following line:
=INDEX(order,MATCH(0,COUNTIF($A$1:A1,order),0)) + CTRL + SHIFT + ENTER
If I open your file in compatibility mode then the following formula is found in its place
{=INDEX(order,MATCH(0,COUNTIF($A$1:A1,order),0)) }
but if I attempt to select the formula then the brackets automatically are removed and I get an error message in the cell.
Any insigh is greatly appreciated.
Thank you in advance for your assistance.
Roy
February 7th, 2011 at 10:23 pm
Roy Shore,
The brackets indicate array formula. Press and hold CTRL + SHIFT and then press Enter to create an array formula.
Read this: Introduction to Array Formulas
Thanks for commenting!
February 9th, 2011 at 7:51 am
Oscar........ thanks a lot for the solution this is Exactly what i wanted.............
February 25th, 2011 at 1:53 am
I currently am using a Mac with Excel 2008 and can't seem to locate the "Formulas tab" and "Name Manager" to create a dynamic named range like you did. Can you help me? Just learning...
February 25th, 2011 at 8:16 am
Darold,
I wish I could help you! But I don´t know.
February 25th, 2011 at 6:18 pm
Found it! It is under the "Insert" tab, then "Name", then "Define".
Thanks!
March 18th, 2011 at 9:03 pm
What is the formula if there is a third column of data?
March 21st, 2011 at 8:38 am
Patrick,
Download example workbook with a third column of data
unique-distinct-dependent-lists1 three columns.xls
(Excel 97-2003 Workbook *.xls)
April 15th, 2011 at 3:13 pm
Oscar, thank you for this information. This post is a great help. I have this working right now with 6 drop downs/lists. I wanted to see if you possibly know of a way to see additional information in drop down #4 if there are no selections in drop down #2 and #3. Currently, I have hemisphere in drop down 1, Sector in drop down 2, Region in drop down 3, and Area is drop down 4. If I select a value in drop down #1 (Hemisphere), I would like to see what areas I can filter on in drop down #4 without having to select values in drop down 2 and 3. Is there a way to make that work?
April 17th, 2011 at 8:27 pm
Josh,
Great question!
Read this: Dependent drop down lists – Enable/Disable selection filter
August 24th, 2011 at 8:19 am
Oscar, This post satisfied an exact requirement of mine and has been very helpful indeed. However, if I select my way thru the drop down lists too quickly in Excel 2010 it causes it to crash. If I wait for the field to populate each time I make a selection it works fine but if I hurry thru it then it always crashes. Tried the same file in Excel 2007 and no problem at all. Have you experienced this problem with 2010?
August 24th, 2011 at 1:03 pm
Paul,
I have to admit, I have not yet bought excel 2010.
October 26th, 2011 at 11:23 pm
Oscar, I have a problem. I am building this form for my startup company in EXCEL 2003. I have one column with dropdown list with the parts I am selling. In the other column I want the prices to be automatically added to the cell when I select the part from the dropdown. How do I do that?
Thanks in advance
November 22nd, 2011 at 7:21 pm
Many thanks to you. That's actually one of the best tips I've ever received for Excel. Works like a charme, even when going for more sheets involved (maybe more tricky then, however, still working with some modifications).
December 11th, 2011 at 8:46 am
hi Oscar,
would know how this can be done using Form Control?
December 12th, 2011 at 1:28 pm
panda,
See this blog post:
Apply dependent combo box selections to a filter in excel 2007
December 22nd, 2011 at 8:11 am
Dear Sir,
I am very much impressed with use these formulas.
With Regards
December 25th, 2011 at 3:40 pm
[...] -- Dependent Lists zie Excel Data Validation -- Dependent Lists With INDEX voor unieke waardes zie Create dependent drop down lists containing unique distinct values in excel | Get Digital Help ik heb dependent data validation nooit dieper zien gaan dan 3 nivo's als je het met formules wil [...]
January 4th, 2012 at 11:57 am
hi there - is it just me !! can any one explain why when i type in the bing browser "www.get-digital-help.com" i get a different site yet whe i type it in google its ok? could this be a bug in my system or is any one else having same probs ?
alf saden
January 4th, 2012 at 3:22 pm
Oscar, thank you very much for the help. You have saved me many hours and taught me a lot.
I am having the same problem that Paul is having with 2010. If I try to select the drop down menu very fast in 2010, Excel crashes. In 2007, the "waiting" symbol on the mouse appears for maybe half a second, and then everything is fine. Anyone have any ideas on how to help.
February 5th, 2012 at 12:04 pm
Hello All,
My Question,
I need to create another dependent drop down list based on the first one list? If i change the first list "A" so i will get the results on "B" and "C"
here the link for MREXCEL forum the file is there.
http://www.mrexcel.com/forum/showthread.php?t=610600
please advice.
February 5th, 2012 at 4:50 pm
Said,
If I am not mistaking, I think my answer to Dan answers your question.
February 6th, 2012 at 10:51 am
Oscar, thank you for the help. still the problem is not solved yet. would you please have a look for the excel sheet see if you can do it there? i have done the first dependent list but still i can't do the second! can you please do it for me??
thank you again.