ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Auto Filter - Multiple Conditions? (https://www.excelbanter.com/excel-discussion-misc-queries/240817-auto-filter-multiple-conditions.html)

Ken

Auto Filter - Multiple Conditions?
 
Excel2003 ... Protected WorkSheet ... I do not know Macro Code ... I record
Code then do some creative cut/paste.

Issue ... I have a template with "Auto-Filter" Switches set on every Col. I
use a recorded Macro to accomplish my task (2 Conditions) ... However, now I
need to Filter on more than 2 Conditions ... My present Macro looks like:

Sub A_Test_Filter()
'
' A_Test_Filter Macro

ActiveSheet.Unprotect
Selection.AutoFilter Field:=2, Criteria1:="=0182", Operator:=xlOr, _
Criteria2:="=2321"
Range("C2").Select
End Sub

I have Macro Buttons & I need the Auto-Filter Switches so is there a way to
accomplish this with Macro Code that will not disrupt the present workings of
my Template?

Thanks ... Kha





Ivor Davies

Auto Filter - Multiple Conditions?
 
The custom autofilter can only handle 2 conditions. To identify data with
more than 2 conditions you need to resort to formula's. Some options are the
INDEX and MATCH functions, or you can use the conditional sum wizard to
summarise data based on multiple conditions. These functions will only
summarise data, and not produce a filtered list.

Alternatively if you really need a seperate list rather than summarised data
you could develop some macros. Immediate thoughts are to have a data
worksheet with a macro that sorts different fields based on a set criteria
and copys this 'sorted' data over to a new worksheet.

Can you provide a sample of data and more of a description of what you're
trying to do?

"Ken" wrote:

Excel2003 ... Protected WorkSheet ... I do not know Macro Code ... I record
Code then do some creative cut/paste.

Issue ... I have a template with "Auto-Filter" Switches set on every Col. I
use a recorded Macro to accomplish my task (2 Conditions) ... However, now I
need to Filter on more than 2 Conditions ... My present Macro looks like:

Sub A_Test_Filter()
'
' A_Test_Filter Macro

ActiveSheet.Unprotect
Selection.AutoFilter Field:=2, Criteria1:="=0182", Operator:=xlOr, _
Criteria2:="=2321"
Range("C2").Select
End Sub

I have Macro Buttons & I need the Auto-Filter Switches so is there a way to
accomplish this with Macro Code that will not disrupt the present workings of
my Template?

Thanks ... Kha





Ken

Auto Filter - Multiple Conditions?
 
Ivor ... Unfortunately, I can not provide a sample ... Temp works find for my
Plant as I only needed 1 Filtered condition ... However, a sister Plant
needed more than 2 conditions for Macro Button to work as I have it working.
Solution was to disable this Button on sister Temp.

Above said ... Thank you for your explanation & for supporting these boards
.... Kha

"Ivor Davies" wrote:

The custom autofilter can only handle 2 conditions. To identify data with
more than 2 conditions you need to resort to formula's. Some options are the
INDEX and MATCH functions, or you can use the conditional sum wizard to
summarise data based on multiple conditions. These functions will only
summarise data, and not produce a filtered list.

Alternatively if you really need a seperate list rather than summarised data
you could develop some macros. Immediate thoughts are to have a data
worksheet with a macro that sorts different fields based on a set criteria
and copys this 'sorted' data over to a new worksheet.

Can you provide a sample of data and more of a description of what you're
trying to do?

"Ken" wrote:

Excel2003 ... Protected WorkSheet ... I do not know Macro Code ... I record
Code then do some creative cut/paste.

Issue ... I have a template with "Auto-Filter" Switches set on every Col. I
use a recorded Macro to accomplish my task (2 Conditions) ... However, now I
need to Filter on more than 2 Conditions ... My present Macro looks like:

Sub A_Test_Filter()
'
' A_Test_Filter Macro

ActiveSheet.Unprotect
Selection.AutoFilter Field:=2, Criteria1:="=0182", Operator:=xlOr, _
Criteria2:="=2321"
Range("C2").Select
End Sub

I have Macro Buttons & I need the Auto-Filter Switches so is there a way to
accomplish this with Macro Code that will not disrupt the present workings of
my Template?

Thanks ... Kha






All times are GMT +1. The time now is 09:46 AM.

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