To understand the FILTER function, the syntax is as follows (parameters in brackets are optional):
FILTER(array, include, [if_empty])
- array – is the range or array you want to be included in the result. This can be the entire data set or part of the original data set.
- include – is the test you are performing on each record in the data set. This is the engine that moves the FILTER function forward. Here is where you define the criteria for included versus excluded records.The logic will resemble the test portion of an IF function; we select a range of cells and compare each item in the range to a defined value (ex: B8:B40=E6, where column B is the data and cell E6 is what the data is being compared against.) Any record that results in a TRUE statement will be included in the results. Any record that results in a FALSE statement will be excluded from the results.
- [if_empty] – defines what is to be displayed if no records match the include test (ex: “No Data”). Although this argument is optional, if it is not defined, and no data is returned from the include test, a #CALC! error will be displayed.