Filter data by multiple independent drop-downs for multiple columns

KatRum

New Member
Joined
Nov 1, 2018
Messages
11
Hi All,

I received a really good response from here before and I am hoping someone can help me again. I browsed for an answer but it does not exist so far. I'll explain what I am trying to do and also what I have so far.

I have a large table with a lot of data. I have some dropdowns in B2:B9 which correspond with the data in columns DY:EF in the respective order. I would like the dropdowns to filter the data but only in the respective field. People will only use one dropdown at a time so they don't have to interact with each other. I try to demonstrate below:
I currently have the following which only works for one dropdown:

Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("B2")) Is Nothing Then Exit Sub
Dim lastRow As Long

Dim myTable As Range
lastRow = Cells(Rows.Count, "EG").End(xlUp).Row
Set myTable = Range("A13:EG" & lastRow)
myTable.AutoFilter field:=129, Criteria1:="=*" & Range("B2").Value & "*"
End Sub


DYDZEAEBECEDEEEF
Lot 1Lot 2Lot 3Lot 4Lot 5Lot 6Lot 7Lot 8
Company 1Apples
Oranges
Kiwis
Sofas
Armchairs
Tables
Chairs
Cups
Teapots
Desktop
Laptop
Mouse
Kat
Sarah
Mike
Gemma
Willow
Oak
Scaffolding
Roofers
Peas
Broccoli
Parsnip
Tomato
Potato
Company 2Apples
Kiwis
Chairs
Tables
Teapots
Coffee
Mouse
Keyboard
Mobile
Kat
Gemma
Plumbers
Scaffolding
Electricians
Potato
Broccoli
Parsnip
Company 3Oranges Tea
Coffee
Teapots
Mobile
Sam
Gemma
Oak
Parsnip
Broccoli
Company 4Bananas
Oranges
Kiwis
Sofas Keyboard
Desktop
Sam
Mike
Kat
Elm
Oak
Willow
Scaffolding
Electricians
Broccoli
Company 5Bananas
Apples
Tables
Chairs
CoffeeLaptop
Mouse
Mike
Sam
Steve
Elm
Oak
Willow
Builder
Brickie
Scaffolding
Potato
Carrot
Company 6Melons
Bananas
CupboardsCoffee
Cappucino
Steve
Sam
Elm
Carrot

<colgroup><col><col span="8"></colgroup><tbody>
</tbody>
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    If Intersect(Target, Range("B2:B9")) Is Nothing Then Exit Sub
    Dim lastRow   As Long
    Dim myTable   As Range
    lastRow = Cells(Rows.Count, "EG").End(xlUp).Row
    Set myTable = Range("A13:EG" & lastRow)
    myTable.AutoFilter 'clear previous filter
    myTable.AutoFilter Field:=127 + Target.Row, Criteria1:="=*" & Target.Value & "*"
End Sub
 
Upvote 0
Hi Alpha,

Thank you for coming back to me. I'm afraid the formula doesn't work for some reason. Could you give it another shot?
 
Upvote 0
"Doesn't work" is hardy descriptive and difficult to diagnose. Could you give it another shot?
 
Upvote 0
Sorry I will give this another try. I don't get an error message which is great. The filter works for only the first column (129) which is linked with the B2 dropdown. B3-B9 which should be filtering Fields 130-136
 
Upvote 0
In my testing, it works for all cells in B2:B9 and their respective fields 129-136
I don't know what else to tell you.
 
Upvote 0
In my testing, it works for all cells in B2:B9 and their respective fields 129-136
I don't know what else to tell you.

I apologise I was wrong and happy to admit it, I pasted it in the wrong place. It works and is doing a beautiful job. Thank you AlphaFrog, you **ROCK**
 
Upvote 0

Forum statistics

Threads
1,214,646
Messages
6,120,717
Members
448,985
Latest member
chocbudda

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