Creating multi select dependent dropdown list, how?

abi1224

New Member
Joined
Feb 14, 2024
Messages
1
Office Version
  1. 365
Platform
  1. Windows
Hello I need to have a multi select dependent dropdown list. And as an example below. Can anyone help please?



1707949308824.png
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
I'm not sure how you'd combine the dependencies with multiple selection data validations, but see if this gets you close to where you want to be. Note the formulas in cells L3 and M3 (make the ranges in the formulas as big as you need them to be) and the validation list references. Using this sheet:

Multi validation selections.xlsm
ABCDEFGHIJKLMN
1
2ItemsFruitsVegetablesDrinks
3FruitsApplePotatoPepsiFruitsApple
4VegetablesBananaCucumberColaVegetablesBanana
5DrinksOrangeFantaDrinksOrange
6RedbullPotato
7Level 1Level 2Cucumber
8Fruits, DrinksBanana, Orange, FantaPepsi
9Cola
10Fanta
11Redbull
12
Sheet1
Cell Formulas
RangeFormula
L3:L5L3=FILTER(A3:A11,A3:A11<>"")
M3:M11M3=TOCOL(H3:J6,1,1)
Dynamic array formulas.
Cells with Data Validation
CellAllowCriteria
D8List=$L$3#
E8List=$M$3#


And this code in the sheet code module of the above sheet (right click the sheet tab name, select View Code, and put the code in the window that appears on the right of screen).

VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    Dim Oldvalue As String, Newvalue As String
    Application.EnableEvents = False
    On Error GoTo Exitsub
    If Target.Address = "$D$8" Or Target.Address = "$E$8" Then
        If Target.SpecialCells(xlCellTypeAllValidation) Is Nothing Then
            GoTo Exitsub
            Else
            If Target.Value = "" Then GoTo Exitsub Else
            Application.EnableEvents = False
            Newvalue = Target.Value
            Application.Undo
            Oldvalue = Target.Value
            If Oldvalue = "" Then
                Target.Value = Newvalue
                Else
                If InStr(1, Oldvalue, Newvalue) = 0 Then
                    Target.Value = Oldvalue & ", " & Newvalue
                Else
                Target.Value = Oldvalue
                End If
            End If
        End If
    End If
Exitsub:
    Application.EnableEvents = True
End Sub

Link to demo file Here
 
Upvote 0

Forum statistics

Threads
1,223,884
Messages
6,175,171
Members
452,615
Latest member
bogeys2birdies

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