ajFilterArray function
Description
The ajFilterArray function filters a range of data based on the given criteria and extracts the records that meet this criteria.
Syntax
ajFilterArray(in_array, include, [if_empty], [convert_to_text])
Argument Name | Description |
---|---|
in_array (required) | The range of cells to be filtered. |
include (required) | A range of cells that specifies the condition to filter the range of cells specified in ‘In_array’. 1 means including the row while 0 means excluding the row. The number of rows in Include range must match the number of rows in In_array. |
if_empty (optional) | Specify the message to be shown when none of the rows meets the condition. If you do not specify anything, the default value will always be an empty string (“”). |
convert_to_text (optional) | If it equals TRUE, the return result will be converted to string values. If it equals FALSE, the return result will preserve the original data type but any string value that has more than 256 characters will cause an error. If you do not specify anything, the default value will always be FALSE. |
The function will return:
1) Content type: Filtered records
2) Method: Cell array
Example
Example 1
As you can see from the above example, the result in cell array B11:E14 is filtered with the condition range F2:F5, which is using the condition formula '{=C2:C5<=3} to calculate the condition if the row should be filtered out or not. Therefore, the filter result for C2 is false and the filter results for others are true. Thus, the row B2:E2 has been excluded.
Example 2
Similar with example 1, but has changed all input conditions to False so that no data can be filtered. The vaue of if_empty would be shown when no data was filtered.