The FILTER function in Excel is a powerful tool that allows users to retrieve a subset of data from a specified range based on defined criteria. This function simplifies the process of data analysis, enabling users to extract meaningful insights effortlessly.
Syntax
FILTER(array, include, [if_empty])
- array: The range of cells that you want to filter.
- include: A Boolean array that specifies which elements in the array to include based on the stated criteria.
- if_empty: Optional. The value to return if no entries meet the criteria. Default is an error if omitted.
Example #1
=FILTER(A1:B10, A1:A10="Sales")
This function filters data in the range A1:B10 to show only rows where column A equals “Sales”. For example, if the data in A1:A10 had “Sales” in rows 3 and 5, the result would be the corresponding rows from B3 and B5.
Example #2
=FILTER(D1:D10, E1:E10>100)
This function extracts values from D1:D10 where the corresponding values in E1:E10 are greater than 100. If E1:E10 contained values like 50, 150, and 200, the filtered results would include values from D2 and D3, assuming that’s where those greater values are found.
Example #3
=FILTER(A1:D10, C1:C10="Pass", "No Data")
This function retrieves all rows from A1:D10 where column C equals “Pass”. If no rows meet that criterion, it will return the message “No Data” instead of an error.
Error handling
- CALC!: Indicates that the FILTER function has been used, but there are no matching entries based on your criteria.
- VALUE!: This error appears when the array argument is of a different size than the include argument’s logical array.
- REF!: Occurs if the reference for one of the parameters is invalid, such as if the range specified in array does not exist.