Skip to content

Latest commit

 

History

History
46 lines (32 loc) · 1.87 KB

filter-function.md

File metadata and controls

46 lines (32 loc) · 1.87 KB
title keywords f1_keywords ms.assetid ms.date ms.localizationpriority
Filter function (Visual Basic for Applications)
vblr6.chm1008912
vblr6.chm1008912
00630b25-e7b8-5c32-b6d1-9816f01c3a0f
12/12/2018
medium

Filter function

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

Syntax

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

The Filter function syntax has these named arguments:

Part 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 by using the setting of the Option Compare statement.
vbBinaryCompare 0 Performs a binary comparison.
vbTextCompare 1 Performs a textual comparison.
vbDatabaseCompare 2 Microsoft Access only. Performs a comparison based on information in your database.

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

See also

[!includeSupport and feedback]