If filter criteria matched return values if it doesn't move to another filtering criteria

siddo

Board Regular
Joined
May 26, 2020
Messages
106
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
Hi, I have 8 filtering criteria in a single column, I'm trying to build a macro which would put a filter based on each criteria however the issue is if it doesn't find any value in the filter all other value goes blank and sometimes I'm even unable to put the filter using the formula, request if you could help
VBA Code:
Range("AF2").Select
ActiveSheet.Cells(1, 1).AutoFilter Field:=6, Criteria1:="*Pre-Imp*", Criteria2:="*Readiness*", Criteria3:="*S12*", Criteria4:="*IS12*", Criteria5:="*TIX*", Criteria6:="*SSA*", Criteria7:="*#SR*", Criteria8:="*#$*",Operator:=xlAnd
Range("A1").CurrentRegion.Select
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
Hi, I have 8 filtering criteria in a single column, I'm trying to build a macro which would put a filter based on each criteria however the issue is if it doesn't find any value in the filter all other value goes blank and sometimes I'm even unable to put the filter using the formula, request if you could help
VBA Code:
Range("AF2").Select
ActiveSheet.Cells(1, 1).AutoFilter Field:=6, Criteria1:="*Pre-Imp*", Criteria2:="*Readiness*", Criteria3:="*S12*", Criteria4:="*IS12*", Criteria5:="*TIX*", Criteria6:="*SSA*", Criteria7:="*#SR*", Criteria8:="*#$*",Operator:=xlAnd
Range("A1").CurrentRegion.Select
I can use the Array option but the data which I have does not all the criteria mentioned, sometimes it has 4 criteria's sometimes it has 5, basically it varies
 
Upvote 0
You can't use wildcard filtering for more than 2 criteria on the one field using AutoFilter.
You will need to use either a helper column or Advanced Filter.

If you want to use Advanced Filter,
  • what is the sheet name and range (including the heading) that contains your data (or if a table the table name) ?
  • What is the sheet name and range (including the heading) that contains your list of items to filter on ?
  • What is the heading of Column 6 / the filter column ?
An XL2BB of some of your data would also be helpful.
 
Upvote 0
Solution
That makes sense, thank you Alex
You can't use wildcard filtering for more than 2 criteria on the one field using AutoFilter.
You will need to use either a helper column or Advanced Filter.

If you want to use Advanced Filter,
  • what is the sheet name and range (including the heading) that contains your data (or if a table the table name) ?
  • What is the sheet name and range (including the heading) that contains your list of items to filter on ?
  • What is the heading of Column 6 / the filter column ?
An XL2BB of some of your data would also be helpful.
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,333
Members
452,636
Latest member
laura12345

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