This formula returns data where: account begins with “x” AND region is “east”, and month is NOT April. account begins with “x” AND region is “east”, and month is NOT April. The filtering logic of this formula (the include argument) is created by chaining together three expressions that use boolean logic on arrays in the data. The first expression uses the LEFT function to test if Account begins with “x”: The result is an array of TRUE FALSE values like this: The second expression tests if Region is “east” with the equal to (=) operator: The result is another array: The third expression uses the MONTH function with the NOT function to test if the month is not April: which yields: Note that the NOT function reverses the result from the MONTH expression. All three arrays are multiplied together. The math operation coerces the TRUE and FALSE values to 1s and 0s, so at this point we can visualize the include argument like this: Boolean multiplication corresponds to the logical function AND, so the final result is a single array like this: The FILTER function uses this array to filter the data, and returns the four rows that correspond with the 1s in the array.
Extending criteria
The expressions used to create the include argument in filter can be extended as needed to handle even more complex filters. For example, to further filter data to include only rows where amount > 10000, you could use a formula like this:
Dave Bruns
Hi - I’m Dave Bruns, and I run Exceljet with my wife, Lisa. Our goal is to help you work faster in Excel. We create short videos, and clear examples of formulas, functions, pivot tables, conditional formatting, and charts.