Dependent Data Validation with Large List

IainRourke11

New Member
Joined
May 7, 2016
Messages
3
Hi all,

I have a bunch of information copied from the internet in a nice structured table. I am trying to create a separate table that a user can make selections using data validation drop downs. These drop downs will be dependent on what the user has selected previously.

I have done something similar before, by making unique lists, then naming them such that when the user uses the 2nd drop down list, only the appropriate information is available, based on their choice in the first drop down. There are a few really good examples of this on youtube.


My issue is, that the table is very long, so it would take me a while to set up all the necessary unique lists such that my multiple data validation drop downs would function correctly. Is there a quicker way I can go about creating and naming my lists. Thats the only time consuming bit for me, once that is done, I am good. Below is an small extract of the table I am working with:

TypeODConnectionGradeAdjusted Weight
Drill Pipe
5"
NC50S-13524.11
Drill Pipe5"NC50G-10524.11
Drill Pipe5"XT50S-13523.65
Drill Pipe5 1/2"TT550TSS-10525.3
Drill Pipe5 1/2"XT54HS3-12528.5
HWDP
3 1/2"etc.etc.etc.
HWDP3 1/2"etc.etc.etc.
HWDP3 1/2"etc.etc.etc.
HWDP3 1/2"etc.etc.etc.
HWDP5"etc.etc.etc.
HWDP5"etc.etc.etc.
HWDP5"etc.etc.etc.
HWDP5"etc.etc.etc.
Drill Collars6 1/2"NC46etc.etc.
Drill Collars6 1/2"NC50etc.etc.
Drill Collars8"6 5/8" Regetc.etc.
Drill Collars8 1/4"6 5/8" Regetc.etc.
Wash Pipe
2 7/8"PH-6etc.etc.
Wash Pipe5"Hydril CSAC-95etc.

<tbody>
</tbody>

So the user will use 5 drop downs (column headings in row 1) on a separate sheet, based on their selections, a look up function will display some property in column 6 (not shown above). I know how to do the lookup/match/index part of this too. Really just trying to simplify the workload of getting unique lists created.

First they will choose between Drill Pipe, HWDP, Drill Collars and Wash Pipe. That's simple enough. So if I chose drill pipe in the first column, when I choose from the second column, I only want 5" and 5 1/2" to appear, like wise for the third column and so on.

Any help would be appreciated, let me know if you need more info.

Thanks,

Iain.
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
Is there a quicker way I can go about creating and naming my lists.

If your data starts in A1 try running the code below to create your named ranges (names will be as per row1).

Rich (BB code):
Sub AddNames()
    Dim Rws As Long, Cols As Long, Rng As Range
    
    Rws = Cells(Rows.Count, "A").End(xlUp).Row
    Cols = Cells(1, Columns.Count).End(xlToLeft).Column
    
    Set Rng = Range(Cells(1, 1), Cells(Rws, Cols))
    Rng.CreateNames Top:=True, Left:=False, Bottom:=False, Right:= _
                    False
End Sub
 
Upvote 0
Thanks, that almost worked for my data set, however the named lists that were created had duplicates.

Also, the user would be able to select something in say column 3, that doesn't exist. To use a different example, it would be like saying:

Fruit/Veg: Fruit Type of Fruit: Banana Coulor of fruit: Blue

I would like to create my drop downs such that the user cant select an incorrect colour, so in the corrected version, only yellow would be available to the user.

Thanks for your help.

Iain.
 
Upvote 0
Creating the dependent dropdowns I didn't state the code did and am still not that is down to you as in
Any help would be appreciated,


As for the unique items the code below will create the unique items and create named ranges in a new sheet.
It will not create your dependent dropdowns.

Change Sheet2 to your original sheets name.


Rich (BB code):
Sub AddNames()
    Dim Rws As Long, Cols As Long, Rng As Range, xCol As Long

    With Sheets("Sheet2")
        Rws = .Cells(Rows.Count, "A").End(xlUp).Row
        Cols = .Cells(1, Columns.Count).End(xlToLeft).Column
        Worksheets.Add(After:=Worksheets(Worksheets.Count)).Name = "mySht"

        For xCol = 1 To Cols

            .Range(.Cells(1, xCol), .Cells(Rws, xCol)).AdvancedFilter Action:=xlFilterCopy, CopyToRange:=Sheets("mySht").Cells(1, xCol), Unique:=True
        Next
    End With
    Set Rng = Sheets("mySht").Range(Sheets("mySht").Cells(1, 1), Sheets("mySht").Cells(Rws, Cols))
    Rng.CreateNames Top:=True, Left:=False, Bottom:=False, Right:= _
                    False
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,051
Messages
6,122,872
Members
449,097
Latest member
dbomb1414

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