ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Filter Criteria (https://www.excelbanter.com/excel-programming/285540-filter-criteria.html)

desmondleow[_7_]

Filter Criteria
 
I need to write a filter criteria with 3 conditions. It seems like m
code doesn't work for 3 criterias. Can somebody help me?

Selection.AutoFilter Field:=12, Criteria1:="=P01", Operator:=xlOr
Criteria2:="=P02", _
Operator:=xlOr, Criteria3:="=BPBT"

Thanks a lot!

Regards

--
Message posted from http://www.ExcelForum.com


Tom Ogilvy

Filter Criteria
 
Autofilter does not support 3 criteria - only two. You could create a dummy
column that has a formula like

=if(or(C2="P01",C2="P02",C2="BPBT"),"Show","No Show")

then drag fill that down the column and filter on that column.

If P01 and P02 are the only entries that start with P, you could use two
criteria
Critera1:="=P*"
Criteria2:="=BPBT"

--
Regards,
Tom Ogilvy

"desmondleow" wrote in message
...
I need to write a filter criteria with 3 conditions. It seems like my
code doesn't work for 3 criterias. Can somebody help me?

Selection.AutoFilter Field:=12, Criteria1:="=P01", Operator:=xlOr,
Criteria2:="=P02", _
Operator:=xlOr, Criteria3:="=BPBT"

Thanks a lot!

Regards!


---
Message posted from http://www.ExcelForum.com/





All times are GMT +1. The time now is 11:05 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com