| Components | All | New | MacOS | Windows | Linux | iOS | ||||
| Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old | |
XL.Sheet.AutoFilter.SetCustomFilter
Sets the custom filter criteria.
| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
| XL | 7.3 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
MBS( "XL.Sheet.AutoFilter.SetCustomFilter"; BookRef; SheetIndex; FilterColumnIndex; Operator1; Value1 { ; Operator2; Value2; AndOperator } ) More
Parameters
| Parameter | Description | Example | Flags |
|---|---|---|---|
| BookRef | The reference number for the workbook. | $ref | |
| SheetIndex | The index of the sheet. This number ranges from 0 to XL.Book.SheetCount-1. | 0 | |
| FilterColumnIndex | The column index of the filter. Range from 0 to XL.Sheet.AutoFilter.ColumnSize-1. |
$FilterColumn | |
| Operator1 | The operator used by the filter comparison in the first filter criteria. Can be =, ≠, <, ≤, > or ≥ |
"=" | |
| Value1 | value used in the first filter criteria | 10 | |
| Operator2 | The operator used by the filter comparison in the second filter criteria. Can be =, ≠, <, ≤, > or ≥ |
"=" | Optional |
| Value2 | The value used in the second filter criteria. | "20" | Optional |
| AndOperator | Flag indicating whether the two criterias have an "and" relationship. Pass "And" or "Or". |
"Or" | Optional |
Result
Returns OK or error.
Description
Sets the custom filter criteria.Operator1: operator used by the filter comparison in the first filter criteria; Value1: value used in the first filter criteria; Operator2: operator used by the filter comparison in the second filter criteria; Value2: value used in the second filter criteria; AndOperator: Flag indicating whether the two criteria have an "and" relationship.
Examples
Sets custom filter:
Set Variable [ $sheet ; Value: 0 ]
Set Variable [ $r ; Value: MBS( "XL.Sheet.AutoFilter"; $book; $sheet ) ]
Set Variable [ $r ; Value: MBS( "XL.Sheet.AutoFilter.SetRef"; $book; $sheet; 2; 10; 1; 4) ]
Set Variable [ $r ; Value: MBS( "XL.Sheet.AutoFilter.AddFilter"; $book; $sheet; 0; "test" ) ]
Set Variable [ $r ; Value: MBS( "XL.Sheet.AutoFilter.AddFilter"; $book; $sheet; 1; "test" ) ]
Set Variable [ $r ; Value: MBS( "XL.Sheet.AutoFilter.SetCustomFilter"; $book; $sheet; 1; "="; 10; "="; "20"; "Or" ) ]
Set Variable [ $r ; Value: MBS( "XL.Sheet.ApplyFilter"; $book; $sheet ) ]
Set Variable [ $r ; Value: MBS( "XL.Sheet.AutoFilter"; $book; $sheet ) ]
Set Variable [ $r ; Value: MBS( "XL.Sheet.AutoFilter.SetRef"; $book; $sheet; 2; 10; 1; 4) ]
Set Variable [ $r ; Value: MBS( "XL.Sheet.AutoFilter.AddFilter"; $book; $sheet; 0; "test" ) ]
Set Variable [ $r ; Value: MBS( "XL.Sheet.AutoFilter.AddFilter"; $book; $sheet; 1; "test" ) ]
Set Variable [ $r ; Value: MBS( "XL.Sheet.AutoFilter.SetCustomFilter"; $book; $sheet; 1; "="; 10; "="; "20"; "Or" ) ]
Set Variable [ $r ; Value: MBS( "XL.Sheet.ApplyFilter"; $book; $sheet ) ]
See also
- XL.Book.SheetCount
- XL.Sheet.ApplyFilter
- XL.Sheet.AutoFilter
- XL.Sheet.AutoFilter.AddFilter
- XL.Sheet.AutoFilter.ColumnSize
- XL.Sheet.AutoFilter.GetCustomFilter
- XL.Sheet.AutoFilter.SetRef
This function checks for a license.
Created 1st July 2017, last changed 3th March 2022
MarkDown version: XLSheetAutoFilterSetCustomFilter.md