Sign in with Microsoft
Sign in or create an account.
Hello,
Select a different account.
You have multiple accounts
Choose the account you want to sign in with.

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

Syntax

Filter( sourcearray , match [, include ] [, compare ] )

The Filter function syntax has these arguments:

Argument

Description

sourcearray

Required. One-dimensional array of strings to be searched.

match

Required. String to search for.

include

Optional. Boolean value indicating whether to return substrings that include or exclude match. If include is True, Filter returns the subset of the array that contains match as a substring. If include is False, Filter returns the subset of the array that does not contain match as a substring.

compare

Optional. Numeric value indicating the kind of string comparison to use. See Settings section for values.


Settings

The compare argument can have the following values:

Constant

Value

Description

vbUseCompareOption

–1

Performs a comparison using the setting of the Option Compare statement.

vbBinaryCompare

0

Performs a binary comparison.

vbTextCompare

1

Performs a textual comparison.

vbDatabaseCompare

2

Microsoft Office Access 2007 only. Performs a comparison based on information in your database.


Remarks

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

The array returned by the Filter function contains only enough elements to contain the number of matched items.

Need more help?

Want more options?

Explore subscription benefits, browse training courses, learn how to secure your device, and more.

Communities help you ask and answer questions, give feedback, and hear from experts with rich knowledge.

Was this information helpful?

What affected your experience?
By pressing submit, your feedback will be used to improve Microsoft products and services. Your IT admin will be able to collect this data. Privacy Statement.

Thank you for your feedback!

×