So far in this Data Validation series, we have learnt to create normal drop down list and dynamic drop down list using different techniques with data validation in Excel.
And, today, in this chapter, we will show you how to create Dependent Drop Down list in Microsoft Excel, using different methods.
Dependent Drop Down list is also known as cascading data validation, and, it limits the choices in a drop down list, depending on the value selected in the other cell that contains data validation. In other words, it depends on the value selected in the first drop down list which determines the values to be displayed in the second drop down list.
This is a very common scenario of working with large data or some dynamic reports, where you want to have 2nd cell display a list that is dependent on the list item chosen in first drop down.
As we know that in excel, there are plenty of ways for doing a particular task and similarly, there are many ways of creating dependent data validation in Excel. And, today, we will demonstrate 5 different techniques to create dependent data validation list.
The raw data can be in any order or format and every time you can’t change the data or format to get what you are looking for.
So, we’ve taken one data set but in 3 different formats to get the dependent drop down list. And, As you can see our data is on the left side that is from column A to column E, and we will have our expected output on the right side that is in column J & K. Column J is going to have the primary validation list whereas the column K will be dependent and will display the values depending on the value selected in the column J.
1st Example:-
2nd Example:-
3rd Example:-
1st Example:-
We have product list for each product code from column A8 to E13. And, we want to select the product code in J10, then depending on the selected product code, a product name in cell K10.
First Method:-
The first method is very simple and short, and it requires only 3 steps to get the depending drop down list. However, it only works successfully until you don’t make any changes to your range. Once, you modify your data then you will have to modify the named range first in order to get the updated cascading data validation.
Follow the steps given below:-
Note: - Spaces and other special characters except underscore and period are not allowed as names. By default, it will be converted into underscore. So, use underscore character and period to separate words. Also, the first letter cannot be a number; it must be a letter, an underscore or a backslash.
Now, we will create drop down list:-
In data validation, to create the dependent list, we have used INDIRECT function to return the value based on the primary data validation list. And, to replace underscore with space, we will use SUBSTITUTE function inside INDIRECT function.
When we select any product code in cell J10 then product list of selected product code will appear in cell K10. For example: - We have selected ETV 501, now you can see dependent product list is appearing in cell K10
Note: - Whenever you will add the product name and product code that will not appear in the list.
For Example: - We have added Product 26 under the ETV 505 product code, but when we select ETV 505 product then added product does not appear in the drop down list.
So, this is how you can create dependent drop down list using simple technique in just 3 simple steps.
2nd Example:-
In this example, we will see how to get a dependent dropdown list when you have your data like shown in this vertical table.
We will use two different methods to create dependent drop down list. Both are almost similar techniques. However, the one is without the named range and the other will have the named range.
1st Method:-
To do the same, we will use OFFSET, MATCH & COUNTIF functions together.
Since we know OFFSET function is used to create the dynamic range, therefore, to create “Dynamic data validation” list, we use OFFSET function to return the dynamic range.
MATCH is used to return the relative position of an item in a list in Excel. And, here it will help us to match the category selected in primary drop down list in our range on the sheet, and it will return a number.
And, COUNTIF is used to get the count of cells that matches criteria. And, here we will use this to count the number of rows to show up by using the COUNTIF function.
Follow the steps given below:-
So, this is how you can get the dependent list by taking cell references in the function.
2nd Method:-
In the next method, we will use named range in the same function to get the cascading data validation. First we’ve to create the dynamic list for product code. In case of any new product added to the data, the drop down should be updated to display the same.
To do the same, follow the steps given below:-
=OFFSET('DependentDropDownList'!$B$20,0,0,COUNTA('DependentDropDownList'!$B$20:$B$32))
As we have created a dynamic list for unique products, now, we will create dynamic range for product code range which is in column D.
Follow the same steps which we have followed for unique product:-
=OFFSET('Dependent Drop Down List'!$D$20,0,0,COUNTA('Dependent Drop Down List'!$D$20:$D$35))
=OFFSET($E$19,MATCH($J$22,Product_Code,0),0,COUNTIF(Product_Code,J22))
Now we will see what happens when we add any new product code to the list? Will these drop-down lists be updated?
Let’s add new product in the list; Follow the steps given below:-
3rd Example:-
We have the dynamic headings directly from the table, and we will add new products to the range. The table is in the same format which we used for 1st method.
4th Method:-
Follow the steps given below:-
And, now we will create the named range for each heading, follow the steps given below:-
Now, we will prepare the parent drop down list
Now select some item in the J42, say we select “Item 01” and the look at the K42 drop down list. And, like previous 3 methods, we got dependent list here as well.
So, what’s new? In the first example, you could not add any product to the list but here, you can add any new product. So, say we add new product to this item. We go to A45, and we type “ETV-501 Prod 05” and then come back to K42 and here you go. You can see, the new product has been added.
When we select “Item 06”,we go to K42 and click on drop down list. Surprisingly, nothing happens when we click on the drop down arrow. That’s because we have created everything dynamic and forgot to create dynamic range for table which is why the products do not get displayed in the child list.
To do that, we need to use different techniques. There are two methods of doing that. You can either create the table or simply use the OFFSET function only. And, in the next method, we will use OFFSET function, and we’ll see the trick to expand the table range as well.
=OFFSET($A$40,1,MATCH($J$43,$40:$40,0)-1,COUNTA(OFFSET($A$40,1,MATCH($J$43,$40:$40,0)-1,1000,1)))
Now, we go back and select “Item 06 in the J43 cell and return to K43 and click on drop down arrow. But, this time list shows products which we have added for new item. And, we select first product “ETV-506 Prod 01”.
This is how you can create the dependent drop down list using different methods on any type of data format.
Click on the video link for quick reference to the use of it. Subscribe to our new channel and keep learning with us!
If you liked our blogs, share it with your friends on Facebook. And also you can follow us on Twitter and Facebook.
We would love to hear from you, do let us know how we can improve, complement or innovate our work and make it better for you. Write us at info@exceltip.com
The applications/code on this site are distributed as is and without warranties or liability. In no event shall the owner of the copyrights, or the authors of the applications/code be liable for any loss of profit, any problems or any damage resulting from the use or evaluation of the applications/code.
I think this is what I need I at A2:AH2 I have listed 34 suppliers with the products they supply under the header name. for example, AG2 says Supplier-AD and list 2 product Eggs in totes and Eggs in pails. I want to choose a supplier lets to say Supplier-AD and have it return the name of the 2 products. I would also like 2 tweaks first to be able to get the number of products supplied by that supplier, in this case, 2 and second get the risk level of the supplier meaning high risk or low risk.
Thanks
I WANT TO LEARN " INDIRECT" & "OFFSET" FUNCTION, KINDLY SEND ME YOUR TUTORIAL VIDEOS IN THIS REGARDS.
Hello
Right now im using the method 3, my question is would it be posible to do a searchable list of products codes and product names supposing you have allot of different ITEMS.
How is it done?
Thanks for the vid it was very helpfull