Filter with more than 2 criteria

jonascruz

New Member
Joined
May 19, 2016
Messages
6
Hello . When I filter the column with only two criteria , it works well . But when I add 1 more criteria , it does not display the desired result. Does anyone know how I can filter 3 text criteria in this column ?



Materials (Table)
Office chair
Blue Computer Chair
Red Computer Chair
Pink Computer Kids Chair
Set of pens
Post it
Case
Notebook with logo
Black pencil 2
Black pencil 5
Transparent ruler
Opaque ruler




Code:
Sub filterTextNcriteria()
'
' filterTextNcriteria Macro
'
ActiveSheet.Range("A2:A13").AutoFilter Field:=1, Criteria1:=Array("*chair*", "black*", "*ruler*"), Operator:=xlFilterValues
'ActiveSheet.Range("A2:A13").AutoFilter Field:=1, Criteria1:=Array("*chair*", "black*"), Operator:=xlFilterValues
End Sub
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
Autofilter can only do 2 'Or' criteria when using the 'contains' options.
I mean when you use wildcards on your criteria "*chair*", that is making the autofilter use the custom text filter option 'Contains'
It can only do 2 of those.

You'll probably need to use a helper column with a formula to determine if the cell contains any of the 3 words..

Say in B2 and filled down
=SUM(COUNTIF(A2,{"*chair*", "black*", "*ruler*"}))>0

Then filter on column B for TRUE.
 
Upvote 0
I could adapt this array directly in the column where I would like to show the information. I just had trouble changing the formula for Excel Brazil because it is a little different, but it all worked out .Thanks a lot for the help.
****** id="cke_pastebin" style="position: absolute; top: 0px; width: 1px; height: 1px; overflow: hidden; left: -1000px;">I could adapt this array directly in the column where I would like to show the information. I just had trouble changing the formula for Excel Brazil because it is a little different, but it all worked out .Thanks a lot for the help.</body>
 
Upvote 0

Forum statistics

Threads
1,214,945
Messages
6,122,395
Members
449,081
Latest member
JAMES KECULAH

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