Filtering using cell partial reference

Pansoto

New Member
Joined
May 15, 2022
Messages
5
Office Version
  1. 2016
Platform
  1. Windows
Test_MrExcel.xlsx
ABCDE
1MODCO← Search Inputs
2TYPESingle
3SIZE
4POWER2,2
5
6
7ITEMMOD.TYPESIZEPOWER
81AZ 566 TFFElectrical Single5"2,5 KW
92AZ 586 TFTElectrical Double25 mm2000 W
103AV 586 FFTElectrical Double8"3 KW
114CO 144 BRDMechanical Single3"2,2 HP
125CO 366 TFDMechanical Single4"2,8 HP
136CO 928 TFTHydraulic Double50 mm15 N
147AV 799 FRRElectrical Phased75 mm1,6 Kw
158KQ 66 RRTFMechanical Phased10"2,8 HP
169PSN 888 JKKElectrical Single200 mm2000 w
1710PSN 566 BRDHydraulic Tempo50 mm10 N
1811DR1 978 99Phased Milling5"3 Kw
1912DR3 926 55Termal Uni32"Deriv
Test 2


Good evening,
I am extremely unexperienced, and looked around all day, forgive me if it is a very simple solution, and or it has already being asked multiple times.
I am trying to use the cell range C1:C4 to input partial matches of what i would like to filter from the table.
So far I could come up with a VBA simple code, but only works for exact match and only if all fields are filled with a positive match:

Dim ws1 As Worksheet
Set ws1 = Sheets("TEST2")
With ws1.Range("A7:E19")
.AutoFilter Field:=2, Criteria1:=ws1.Range("C1").Value
.AutoFilter Field:=3, Criteria1:=ws1.Range("C2").Value
.AutoFilter Field:=4, Criteria1:=ws1.Range("C3").Value
.AutoFilter Field:=5, Criteria1:=ws1.Range("C4").Value
End With

I tried (found on another forum) another code supposed to match "partially" the string for the filter:
Dim ws1 As Worksheet
Set ws1 = Sheets("TEST2")
With ws1.Range("A7:E19")
.AutoFilter Field:=2, Criteria1:="*" & ws1.Range("C1").Value & "*"
.AutoFilter Field:=3, Criteria1:="*" & ws1.Range("C2").Value & "*"
.AutoFilter Field:=4, Criteria1:="*" & ws1.Range("C3").Value & "*"
.AutoFilter Field:=5, Criteria1:="*" & ws1.Range("C4").Value & "*"
End With

Does not work.

All I need is to input some key words in the search areas and filter the data accordingly without having to perfect match, or filling all fields. Like if there was a way to tell the Filter Array (that you can manually click selecting/deselecting check boxes) to use a call value as the filter selection. I Cannot create a separate Data table, I need to filter the existing one, as other other columns will have data full of formulas I need to keep.

Hope I made enough sense, explaining what I'm trying to accomplish, and thanks a million for the support.
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
Not sure why it doesn't show in Minisheet, but A7:E7 do have the Data/filter active with scrolldown arrows.
 
Upvote 0

Forum statistics

Threads
1,223,894
Messages
6,175,252
Members
452,623
Latest member
Techenthusiast

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