FILTER function. Get all rows matching the condition.(Microsoft Excel)


Japanese version.

The FILTER function is a related function of Spill that was implemented in 2019 to retrieve data that matches certain criteria.

How it works

arrayRequired argument.
Cell range to filter.
includeRequired argument.
Search criteria.
if_empty#CALCResult for 0 case.



Arrays and Includes.

The first argument specifies the range of the source data, and the second argument specifies the search condition.

In the example below, we extract rows whose Type is Reptiles.


If you enter the FILTER function in one cell, it will automatically expand to match the number of results of the condition.

Cells other than the original cell where the function was first entered are Ghost and cannot be edited.

However, if there is any value in the auto-expand destination cell, it will result in a #SPILL.

If empty.

The third argument specifies the result if not found.If not specified, #CALC!

If specified, the result is the case where the specified value is not found.

If specified, the result is the case where the specified value is not found.

If you want to get only a specific column.

The range of argument 2 need not be included in argument 1.
If you specify only the columns you want to display in argument 1, you can retrieve only those columns.


Large and small conditions.

In the example below, data with Number greater than 6 are extracted.


Multiple conditions.



The following is an example of using + to extract data where "Number" is less than 4 or greater than 7.


logical conjunction

The following is an example of using * to extract data that is Mammals and less than or equal to 6.


Substring Match

Wildcards are not available, but partial match searches can be performed in conjunction with other functions.

FIND and IFERROR functions. Substring Match

The FIND and IFERROR functions can be used to perform partial match searches.


LEFT and Len Functions. Forward Match.

Forward matching conditions are possible with the LEFT and LEN functions.


RIGHT and Len functions. Backward matching.

Backward matching is possible with the RIGHT and LEN functions.


Date/time conditions. Date & Time functions.

You could make the serial value a condition, but
However, it is more difficult to enter, and the formulas are more difficult to understand.
Therefore, you should use the date entered in the cell as the condition or use the Date & Time function together.
For example, the DATE function can be used to compare dates without using serial values.


Use results for other functions

SORT and SORTBY functions.

Since the result of the FILTER function is a range of cells, it can be passed to other functions that take a range of cells as an argument.
For example, the results of a FILTER function can be sorted by a SORT or SORTBY function.


Get the number of results with the ROWS function.

Specifying the result of the FILTER function as the argument of the ROWS function results in the number of cases matching the condition.

Multiple cell ranges.

Multiple ranges can be targeted with the VSTACK and HSTACK functions.



Microsoft Excel Functions Lookup & Reference

Examples of Use.

Formulas to extract only rows with values.

Calculating the median in a Pivot table. Its alternative method.