How to make a Data Validation Dependent Drop Down List From the precedent Row?

Lacan

Board Regular
Joined
Oct 5, 2016
Messages
228
Office Version
  1. 365
Platform
  1. Windows
Hello Guys,

Have this massive extent List that would like to make a Data Validation Dependent Drop Down List from the precedent row.

Will give you a sample data with 4 examples to be very clear that what is the goal in order to choose from Data Validation Dependent Drop Down List from the precedent row.

Can you help me?

Thanks a lot.


Book1
BCDEFGHIJK
2BrickCenterCityNameBrickCenterCityName
3299 Lx - Amadora (MÁgua - Sul)CENTRO CLINICO AVENIDAAmadoraAnnaExample 1299 Lx - Amadora (MÁgua - Sul)CENTRO CLINICO AVENIDAAmadoraAnna
4299 Lx - Amadora (MÁgua - Sul)CENTRO CLINICO AVENIDAAmadoraAnna SimonExample 2300 Lx - Amadora (MÁgua - Sul)Clínica LAR MEDICOSamoucoAnna
5299 Lx - Amadora (MÁgua - Sul)CENTRO CLINICO AVENIDAAmadoraAladinExample 3301 Lx - Amadora (MÁgua - Sul)Clínica LAR JONHAmadoraLuzia
6299 Lx - Amadora (MÁgua - Sul)CENTRO CLINICO AVENIDAAmadoraSergeExample 4302 Lx - Amadora (MÁgua - Sul)Clínica MEDICA SALisboaPedro
7299 Lx - Amadora (MÁgua - Sul)CENTRO CLINICO AVENIDAAmadoraFernando
8299 Lx - Amadora (MÁgua - Sul)CENTRO CLINICO AVENIDAAmadoraBlyde
9299 Lx - Amadora (MÁgua - Sul)CENTRO CLINICO AVENIDAAmadoraDynom
10300 Lx - Amadora (MÁgua - Sul)CENTRO CLINICO AVENIDAAmadoraVenom
11300 Lx - Amadora (MÁgua - Sul)CENTRO CLINICO FRANKAmadoraYalan
12300 Lx - Amadora (MÁgua - Sul)Clínica LAR MEDICOSamoucoAnna
13300 Lx - Amadora (MÁgua - Sul)Clínica LAR MEDICOSamoucoCosta
14300 Lx - Amadora (MÁgua - Sul)Clínica LAR MEDICOSamoucoMaria
15300 Lx - Amadora (MÁgua - Sul)Clínica LAR MEDICOSamoucoCesar
16300 Lx - Amadora (MÁgua - Sul)Clínica LAR MEDICOSamoucoCarlos
17301 Lx - Amadora (MÁgua - Sul)HospitalAmadoraMaria
18301 Lx - Amadora (MÁgua - Sul)Clínica LAR JONHAmadoraJesus
19301 Lx - Amadora (MÁgua - Sul)Clínica LAR JONHAmadoraMaria
20301 Lx - Amadora (MÁgua - Sul)Clínica LAR JONHAmadoraLuzia
21301 Lx - Amadora (MÁgua - Sul)Clínica MEDICA SALisboaGuilherme
22302 Lx - Amadora (MÁgua - Sul)Clínica MEDICA SALisboaRogerio
23302 Lx - Amadora (MÁgua - Sul)Clínica MEDICA SALisboaPedro
24302 Lx - Amadora (MÁgua - Sul)Dr Peter SaSamoucoAlbino
25302 Lx - Amadora (MÁgua - Sul)Consultorio Dr KingLisboaFernando
Folha6



1581376174648.png
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
This is a fair amount to describe in these windows on Mr. Excel.
However, I would suggest rereading the dependent drop down info in the link I sent earlier.
To get you started, I would insert a column like this (because name ranges cannot have spaces, etc.):


1581435235434.png



Then I'd create these columns and use name ranges (e.g., the three rows for Center 302 are named: : CNTR302)


1581435286242.png



Then I created various Data Validations, such as this one which is in J6:


1581435401985.png



Hope this helps.
 
Upvote 0
This is a fair amount to describe in these windows on Mr. Excel.
However, I would suggest rereading the dependent drop down info in the link I sent earlier.
To get you started, I would insert a column like this (because name ranges cannot have spaces, etc.):


1581435235434.png



Then I'd create these columns and use name ranges (e.g., the three rows for Center 302 are named: : CNTR302)


1581435286242.png



Then I created various Data Validations, such as this one which is in J6:


1581435401985.png



Hope this helps.
Thanks for your help.

Can´t see the images :(
 
Upvote 0
Thanks for your help.

Can´t see the images :(

Dear friend,

First, thank you very much.
However I have a massive extent data that it will take a lot of work to creat range names through 7 columns and more than 2300 rows.

Is there a more easy quick simple way?

Thanks again.
 
Upvote 0
Hi, Lacan
If you already have Dynamic Array function in your Office 365, then you can try this example of dependent data validation (but it's only 3 column data validation). It uses VBA + formula.
Let me know if you're interested in this method & need help to apply it for 4 column data validation in your workbook.
dhee - 3 data validation, dependent, dynamic array 365.xlsm

VBA Code:
'=================================================================================================
'=============== YOU MAY NEED TO ADJUST THE CODE IN THIS PART: ===================================

'sheet's name where the list for data validation is located. [in the sample: sheet "sheet2"]
Private Const sList As String = "sheet2"

'table's name where the list for data validation is located. [in the sample: "Table1"]
Private Const sTable As String = "Table1"

'the helper column
Private Const xH As String = "E"

'range where data validation is located
Private Const sDV1 As String = "B2:B10"  ' for data validation 1
Private Const sDV2 As String = "C2:C10"  ' for data validation 2
Private Const sDV3 As String = "D2:D10"  ' for data validation 2

'==================================================================================================
'==================================================================================================

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

If Target.Cells.CountLarge > 1 Then Exit Sub
'    On Error GoTo skip:
    If Not Intersect(Target, Union(Range(sDV1), Range(sDV2), Range(sDV3))) Is Nothing Then
        Dim f As Range
        Dim MN As String, tx1 As String, tx2 As String, tx3 As String
        
        Application.EnableEvents = False
        Sheets(sList).Columns(xH).ClearContents

        Set f = Sheets(sList).ListObjects(sTable).DataBodyRange
        tx1 = f.Columns(1).Address
        tx2 = f.Columns(2).Address
        tx3 = f.Columns(3).Address
        MN = Me.Name & "!"
        
        With Sheets(sList).Range(xH & 1)
            If Target.Column = Range(sDV1).Column Then
                .Value = "=UNIQUE(" & tx1 & ")"
                            
            ElseIf Target.Column = Range(sDV2).Column And Target.Offset(, -1) <> "" Then
                .Value = "=UNIQUE(FILTER(" & tx2 & "," & tx1 & "=" & MN & Target.Offset(, -1).Address & "))"
            
            ElseIf Target.Column = Range(sDV3).Column And Target.Offset(, -1) <> "" And Target.Offset(, -2) <> "" Then
                .Value = "=UNIQUE(FILTER(" & tx3 & ",(" & tx1 & "=" & _
                MN & Target.Offset(, -2).Address & ")*(" & tx2 & "=" & MN & Target.Offset(, -1).Address & ")))"

            End If
        End With
        
        Application.EnableEvents = True

    End If


End Sub


Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.CountLarge <> 1 Then Exit Sub
    If Not Intersect(Target, Union(Range(sDV1), Range(sDV2))) Is Nothing Then
        
        Application.EnableEvents = False
            If Target.Column = Range(sDV1).Column Then
            Target.Offset(, 1).Resize(, 2).ClearContents
            ElseIf Target.Column = Range(sDV2).Column Then
            Target.Offset(, 1).ClearContents
            End If
        Application.EnableEvents = True
    
    End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,910
Messages
6,175,318
Members
452,634
Latest member
cpostell

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