A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data
The FILTER formula is returning all rows because of how the Boolean logic is combined. In Excel, + acts like OR and * acts like AND when used with Boolean arrays, and operator precedence plus missing parentheses are causing the criteria to evaluate much more broadly than intended.
To filter by:
- City in
Sheet2!F:FmatchingB1 - Record Type in
Sheet2!N:Nbeing either "Expense - Lease" or "Expense - Owned" - SubType in
Sheet2!O:Obeing either "Office" or "E-Suite"
use a FILTER formula that groups the OR conditions inside parentheses and ANDs them together:
=IFERROR(
FILTER(
Sheet2!A12:U1159,
(Sheet2!F12:F1159=B1) *
((Sheet2!N12:N1159="Expense - Lease") + (Sheet2!N12:N1159="Expense - Owned")) *
((Sheet2!O12:O1159="Office") + (Sheet2!O12:O1159="E-Suite"))
),
"No Record Found"
)
Explanation of the logic:
-
(Sheet2!F12:F1159=B1)→ city must matchB1. -
((Sheet2!N12:N1159="Expense - Lease") + (Sheet2!N12:N1159="Expense - Owned"))→ Record Type is either "Expense - Lease" OR "Expense - Owned". -
((Sheet2!O12:O1159="Office") + (Sheet2!O12:O1159="E-Suite"))→ SubType is either "Office" OR "E-Suite". - The
*between these grouped conditions means all three groups must be TRUE for a row to be included.
This structure prevents rows that only match one of the criteria from being included and should stop all documents from being returned.
References: