Range.AutoFilter Method (Excel)

Filters a list using the AutoFilter.


expression. AutoFilter( _Field_ , _Criteria1_ , _Operator_ , _Criteria2_ , _VisibleDropDown_ )

expression An expression that returns a [Range](Excel.Range(Graph property).md) object.


Name Required/Optional Data Type Description
Field Optional Variant The integer offset of the field on which you want to base the filter (from the left of the list; the leftmost field is field one).
Criteria1 Optional Variant The criteria (a string; for example, "101"). Use "=" to find blank fields, or use "<>" to find nonblank fields. If this argument is omitted, the criteria is All. If Operator is xlTop10Items , Criteria1 specifies the number of items (for example, "10").
Operator Optional XlAutoFilterOperator One of the constants of XlAutoFilterOperator specifying the type of filter.
Criteria2 Optional Variant The second criteria (a string). Used with Criteria1 and Operator to construct compound criteria.
VisibleDropDown Optional Variant True to display the AutoFilter drop-down arrow for the filtered field. False to hide the AutoFilter drop-down arrow for the filtered field. True by default.

Return Value



If you omit all the arguments, this method simply toggles the display of the AutoFilter drop-down arrows in the specified range.

Excel for Mac does not support this method. Similar methods on Selection and ListObject are supported.


This example filters a list starting in cell A1 on Sheet1 to display only the entries in which field one is equal to the string "Otis". The drop-down arrow for field one will be hidden.

Worksheets("Sheet1").Range("A1").AutoFilter _ 
 field:=1, _ 
 Criteria1:="Otis", _ 

See also

Range Object