Filter

This function uses specified criteria to filter a one-dimensional array of strings.

Syntax

Filter(inputStrings, value, [ include], [ compare])

Parameters

inputStrings
Required. One-dimensional array of strings to be searched.
value
Required. String to search for.
include
Optional. Boolean value indicating whether to return substrings that include or exclude value. If include is True, Filter returns the subset of the array that contains value as a substring. If include is False, Filter returns the subset of the array that does not contain value as a substring.
compare
Optional. Numeric value that indicates the kind of string comparison to use. The following table shows the possible values for the compare parameter.
Constant
Value
Description
vbBinaryCompare 0 Perform a binary comparison
vbTextCompare 1 Perform a textual comparison
vbDatabaseCompare 2 Not supported

Return Values

Returns a zero-based array containing a subset of a specified string array.

Remarks

If no matches of value are found within inputStrings, Filter returns an empty array. An error occurs if inputStrings is Null or if it is not a one-dimensional array.

The array returned by Filter has one element for each matched item.