Filter with multiple criteria dropdown list

hershey17

New Member
Joined
May 4, 2021
Messages
2
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
  2. Web
Hello,
I am currently working on a spreadsheet with many data, including a dropdown list with multiple selection (I used a VBA code to activate it). Now, on another sheet, I need to extract data from the initial one by using the dropdown list as a criteria, but the advance filter is not considering the word that is not in the beginning of the cell for example: criteria needed is red (ie. Cell with selected dropdown => red, blue, green and another one with selected dropdown => yellow, red, orange). The advanced filter will only take the data with "red" in the beginning but not the other one even if it contains "red".

What do you suggest I can do to filter and extract data according to a multiple dropdown containing the criteria anywhere in the cell?

thank you in advance.
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
Hi,

Attach the file so we can see the data structure. A change to the VBA code may be required.
 
Upvote 0
Hi,

Attach the file so we can see the data structure. A change to the VBA code may be required.

Hello,

Here's what the data looks like. I have a separate list of "Groups" which is the source of column C (dropdown list).

1620199283701.png


After the advanced filter, I get these:

1620199410491.png
1620199448489.png



This is the code that I found to enable multiple selection in a dropdown list:

Private Sub Worksheet_Change(ByVal Target As Range)
' To allow multiple selections in a Drop Down List in Excel (without repetition)
Dim Oldvalue As String
Dim Newvalue As String
Application.EnableEvents = True
On Error GoTo Exitsub
If Target.Column = 3 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
Application.EnableEvents = True
Exitsub:
Application.EnableEvents = True
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,888
Messages
6,175,206
Members
452,618
Latest member
Tam84

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