Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel - AutoFilter on multiple criteria

Status
Not open for further replies.

DAmoss

Technical User
Jul 23, 2003
169
GB
Hi,

I want to AutoFilter cell values are between (<=-11 And >=11) And between (>=-24 And <=24), thats both at the same time. Unfortunately, I'm totally lost on how to create the above range checking, any help would be much appreciated.

Here's my current code below, I can filter one way, but not both together:

With Sheet1

.AutoFilterMode = False

.Range("TrafficRange").AutoFilter Field:=1, Criteria1:="<=-11", Operator:=xlAnd, Criteria2:=">=11

.Range("TrafficRange").AutoFilter Field:=1, Criteria1:=">=-24", Operator:=xlAnd, Criteria2:="<=24

End With
 
How a value may be <=-11 AND >=11 ?

Anyway, for complex filtering, have a look at AdvancedFilter.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Maybe I should have explained better, the filter should show a value:

between (-11 to -24) And between (11 to 24) only
 
If you don't want to follow the AdvancedFilter route you may consider applying an AutoFilter to a derived column containing the Abs value of your TrafficRange's first column.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top