Filtering tables

The FILTER() function enables you to filter data with the number of filters up to the maximum number of columns in a worksheet, sort the results using up to six keys, and pre- or post-filter the data to find compound duplicates consisting of up to 100 keys or columns.

Filter types include: Regex (regular expressions), patterns (* ? ~), similar to (fuzzy searches), all numeric and literal = < > relations, ranges, content length comparisons, empty cells, duplicates.

The function uses the following parameters:

=Filter(search-range, filters, hyperlink-path, options[, empty-string])

search-range

The search-range argument represents a range or an array with rows to filter. It can be of any size up to the maximum number of columns in a worksheet minus one (because the first output column may additionally contain hyperlinks).

If any rows are found in the search range, FILTER() returns an array with the corresponding number of columns.

If you specify the hyperlink option (see below) and apply the Format > Hyperlink style to the first column of the returned array, this first column will contain hyperlinks to the original rows in search-range.

Thus the filtered rows or records can be easily edited. After clicking a given link (or pressing SPACE) and completing editing of the source data, click the back bookmark toolbar button (or press Alt+F11) to return to browsing results in the same place.

filters

The filters argument represents a range or an array with filtering expressions for the subsequent columns in the search-range. The number of cells in filters must not exceed the number of columns in search-range. The n-th cell position in filters is the filter expression for the n-th column in search-range. If there is no filter for a given column, the corresponding filter cell may be left empty.

Entering filters in worksheet cells is easy: you can use the Format > Search Filter format style for the desired cells. This displays formatted filters with syntax coloring for Regex expressions and graphic sort order indicators.

When editing such cells, GS-Calc displays a cell-aligned dialog box with all filter specification and sort options:

*Example

The filter options are as follows:

Note: The duplicates filters are handled slightly differently than other filters. The options parameter enables you to specify whether searching for duplicates should be performed before or after all other filters.

You can also specify filters directly as text cells, for example if you want to generate them using formulas.

hyperlink-path

The hyperlink-path argument represents a worksheet or workbook path that will be used along with cell references if the include hyperlinks option is specified.

Examples:

sheet1
folder1\\sheet1
c:\\documents\ \[sample.gsc]sheet1

In the example screen above, the hyperlink path is left empty because both the data (A1:H100000) and the result (=FILTER(A1:H100000, ...)) are in the same worksheet.

options

The options argument is a number and can be 0 or a combination (sum) of the following values:

The default value is 0.

Note: If you are using FILTER() for very large data sets and expect to change options frequently, use a cell reference for options instead of a hard-coded value. Re-editing the FILTER() formula cell may activate Undo for most of the target range and cause delays before filtering.

empty-string

The optional empty-string argument represents a number or a string that FILTER() should return if no matching rows are found. If omitted, FILTER() returns the #N/A! error code.

Insert > Filter()

You can insert the Filter() function with two clicks using the Insert > Filter() command. The Insert FILTER() dialog box determines optimum parameters including the filters range and creates the formula. On the screen below, the Insert command was used to filter data in the sample.gsc -> orders worksheet with a single OK click. It automatically copies source styles and adds hyperlink and filter expression formatting.

*

The source range 16-element list is a global list created and stored in the settings file. Subsequent source ranges are added in a circular manner by clicking one of the following:

The Copy as Location menu command

*

The Enter toolbar button

*