Home » excel » excel – Data validation without named ranges

excel – Data validation without named ranges

Posted by: admin April 23, 2020 Leave a comment

Questions:

I have the following example list:

list

Note: In my real list I have around 200 options and 400 suboptions

And I would like to have 2 dropdownlists to select any option and it’s suboptions:

For options, I used data validation – list with range =$A$8:$A$12

options

And for suboptions I tried the following:

Named ranges

It works but it needs a lot of manual work to maintain as the suboptions list is updated kind of frequently and AFAIK I would need to create and maintain many named ranges as many options I have.

Example

Named Range:     _ABC05
Refers To:       =Sheet1!$D$9:$D$10
Data validation: = INDIRECT(CONCATENATE("_";SUBSTITUTE(A2;"-";"")))

enter image description here

Again, this works but I am trying to avoid to maintain 200 named ranges.

Any solution without using named ranges or vba?

How to&Answers:

Finally I solve it using dynamic data validation:

In hidden column D, I have the following formula:

=CONCATENATE("D";MATCH(A2;$C$8:$C$15;0)+7;":D";MATCH(A2;$C$8:$C$15;1)+7)

And the data validation like this:

=INDIRECT(D2)

enter image description here

Edit: As mentioned by Aprillion, this will only work if the options list is sorted alphabetically ascending. In my case it is always like that but it would be interesting to know another solution with unsorted data. Also, In this example it is possible to avoid the hidden column and use =indirect(concatenate… in the data validation but in my case I have the lists in a separate worksheet and it is not possible to reference a data validation list in external workbooks or worksheets.

One issue is that once the user select an option and corresponding suboption, and then change again the option, the suboption is still selected even if it is not mapped to the new option. I found one solutions that consists in using a fake list as source of the data validation when C2 already have a value:

=IF(C2="";INDIRECT("$A$8:$A$12");INDIRECT("FakeList"))