FILTERX function

An extended version of FILTER that allows the extended criteria from the FILTER.IFS family.

FILTERX is a multi-threaded non-volatile dynamic array function.

FILTERX handles successive criteria progressively – each criteria only processes rows that pass the previous criteria test.

When the first criteria column is sorted  (FiirstCritSort=1 or -1) FILTERX uses binary search to efficiently do the search.

FILTERX columns can be ranges, calculated columns or arrays.

Up to 18 pairs of Criteria and Columns may be used.

3 Types of Criteria Lists: Include, Exclude and All-Of

FILTERX Syntax

FILTERX([FirstCritSort,] Array, Col1, Crit1 [, Col2, Crit2, …])

FirstCritSort (Optional)

 If omitted the first Criteria column is assumed to be unsorted (and the trailing comma is not required)

A value of 1 indicates that Col1 is sorted ascending, -1 indicates sorted descending.

When sorted binary search will be used for efficient criteria matching on the first criteria column.

Array (required)

The range or array to be filtered. A complete row from Array will be returned for row that meets all of the criteria.

Col1 (required)

Specifies the first Criteria Column. Can be text, a number, a Range Reference, an array of constants or an expression that results in a column array.

Text will be interpreted as a column label in the first row of the RangeArray

Number will be interpreted as a column number within RangeArray.

Range Reference or Array will be interpreted as an independent column outside RangeArray.

An array of constants will be interpreted as a column of data.

An expression will be evaluated by Excel as a calculated column before being passed to the FILTER function.

Criteria Columns must contain the same number of rows as the RangeArray, but allowance is made for a row of column labels in either or both the RangeArray and Criteria Columns.

Crit1 (required)

Specifies the criteria expression to be applied to CriteraColumn1.

The Criteria expression must resolve to a text string starting with an optional criteria operator and ending with a Criteria value.

If no criteria operator is found at the start then = will be assumed.

A Criteria expression may be any Excel expression containing strings, range references, defined names, functions and operators

 

The maximum number of pairs of Criteria Columns and their criteria is 18.

Col2 (optional)

The column (range, array or calculated column) to be searched using Crit2

Crit2 (optional)

The criteria to be applied to Col1

Criteria Operators

Valid Criteria operators are:

The relational operators:

= is equal to

> is greater than

>= is greater than or equal to

< is less than

<= is less than or equal to

¬ is not equal to, also negates following criteria operators

If no operator is given it is treated as =, except that the data type is never converted (see Data Types section below).

The Pattern operators:

~ Like the criteria value pattern using the wild-card characters * and ?

~~ Matches against a regular expression pattern

The Boolean operators:

True the cell value is true

False the cell value is false

Because Excel propagates error values through formulas and expressions all the above criteria operators have no effect when preceding an error value.

Criteria Lists

Criteria can be given either as a single criterion or a list of alternative Criteria.

The list of alternative Criteria can be either an expression returning an array, an array of Constants or a Range Reference.

The list of alternative criteria can either be:

An Inclusion list – a row that matches any of the items in the list will be included.

An exclusion list – a row that matches any of the items in the list will be excluded. The first element in the list must be two not symbols ¬¬ entered as a string.

An All list – row will must match All of the items in the list to be included. The first element in the list must be && (two & characters) entered as a string. This can be used for example to match  between 2 dates.

The individual elements in the array or cells in the Range Reference may also each start with their individual criteria Operator, or may not have a criteria operator.

Criteria Lists Examples:

FILTER.IFS(0,$A$1:$C$6,"Hundreds","Digits",{"Four","One","Two"},"Tens",{"Fifty","Fourty","Thirty","Twenty"})

The Digits column must contain any of Four, One or Two and the Tens column must contain any of Fifty, Forty, Thirty or Twenty.

FILTER.IFS(0,$A$1:$C$6,"Hundreds","Digits",{"Four","One","Two"},"Tens",{“¬¬”,"Fifty","Fourty","Thirty","Twenty"})

The Digits column must contain any of Four, One or Two and the Tens column must NOT contain any of Fifty, Forty, Thirty or Twenty.

FILTERX(tblSalesData,tblSalesData[ShipDate],VSTACK(“&&”, ”>=” & Date(2026,9,24), “<=” & Date(2026,12,31)))

The Sales Data table will be filtered for sales with ship dates between 24 Sep 2026 and 31 Dec 2026 inclusive.

For very large lists it will be more efficient to use COMPARE.LISTS:

FILTERX(tblSalesData,tblSalesData[ShipDate],VSTACK(“&&”, ”>=” & Date(2026,9,24), “<=” & Date(2026,12,31)),COMPARE.LISTS(tblSalesData[Products),HighValueProducts],True)

The Sales Data table will be filtered for the list of High Value Products with ship dates between 24 Sep 2026 and 31 Dec 2026 inclusive.

The Data Type Operators:

#TYPE the data type of the cell is the same as the first data cell in the criteria column

#ERR the cell contains an error value

#TXT the cell contains a string (text) value

#N the cell contains a number (integer or with decimal point, date, time, currency)

#BOOL the cell contains a Boolean True or False

#EMPTY the cell is empty

#ZLS the cell contains a zero length string

#BLANK the cell contains a string of 1 or more blanks/spaces

Any of these criteria operators can be prefixed by ¬ (not) to convert the operator from an inclusion operator to an exclusion operator.

Data Type Comparison

Excel has 5 fundamental data types: Number (integers, real numbers, dates, times, currency), String (text), Boolean (true or false), Error (#NA etc) and Empty (unused cells).

When a column of mixed data types is sorted Excel uses the following comparison relationships:

Numbers < Strings < Booleans < Errors

Empty cells are always sorted last, both in an ascending and a descending sort.

The SpeedTools FILTER functions use the same comparison relationship between data types.

Data Type Conversion

When a criteria value is preceded by any of the criteria operators its data type is not known (Criteria values without any preceding criteria operator have a specific data type).

For example, in “<1234” the 1234 could be a number or could be a string. When this criteria value is being compared to a criteria column that could contain multiple data types the FILTER.IFS functions use the following rules:

When the criteria operator is ~ or ~~ the criteria value and the values in the criteria column will be converted to strings before doing the pattern match.

Otherwise the preferred data type will be the data type of the first data (non-header) cell in the criteria column. FILTER.IFS will attempt to convert the criteria value to the preferred data type. If this is not possible FILTER.IFS will convert the criteria value to a number, then a string, then a Boolean then an error.

Overriding Data Type Conversion using the & Prefix

If your criteria column contains mixed data types (for instance both numeric and string numbers) you can ask FILTER.IFS to try to convert the criteria value to the best possible data type match with each cell in the criteria column.

So FILTER.IFS would use the numeric version of the criteria value to compare with a numeric number and the string version of the criteria value to compare with a string/text number.

You request this by adding a & character as a prefix to the criteria operator (after the ¬ prefix if you are using the exclusion prefix).

Criteria Values

Criteria values and Criteria column values are NOT Case sensitive.

Criteria Like Patterns

Like Patterns can contain:

* Any number of characters, including none

? Any single character

Pattern Examples:

Column Value

Criteria

Result

Criteria Explanation

"aBBBa"

“~a*a"

True

String starting with a followed by any characters and ending with a

“a2a”

“~a?a”

True

String starting with a followed by any single character followed by a

“BAT123khg"

“~B?T*”

True

B followed by any single character followed by T followed by any or no characters

“CAT123khg"

“~B?T*”

False

B followed by any single character followed by T followed by any or no characters

CriteriaColumn2, Criteria2, … (optional)

You can give additional pairs of Criteria Column and Criteria.

All of the Criteria pairs given in a set must be True for a row of data from the Return Column to be included.

"#OR#", nSortedCriteria, (optional)

If you need alternative sets of criteria you can separate them with “#OR#”, nSortedCrits.

A row will be selected from the Return Column if ANY of the alternative sets of Criteria are met.

The row will only be selected once if both alternative sets of criteria are met (no double-counting).

For Example:

CriteriaCol1,Criteria1,CriteriaCol2, Criteria2, “#OR#”,1,CriteriaCol3, Criteria3,CriteriaCol4,Criteria4

A row will be selected from the Return Column if

 (both criteria1 and Criteria2 are True) OR (both Criteria3 and Criteria4 are True)

Note that a Criterion can also contain a list of alternative conditions (see above)