Lists that spill · About 5 minutes
FILTER with two conditions
To keep rows that pass both tests, put each test in parentheses and multiply them: =FILTER(. A row stays only when both are TRUE.
To keep rows that pass either test, add them instead: (. AND and OR don't work here: they give one TRUE or FALSE for the whole column, not one per row.
These work in Excel 365, Excel 2021 or later and Google Sheets. Excel 2016 and 2019 don't have them.
Part of Plus
Free during our founding launch: sign in to unlock this lesson's exercises, the timed practice sets and the rest of Plus. The free lessons stay free, with no account needed.
What FILTER with more than one test does
FILTER can keep rows that pass two tests at once, like tasks owned by Lee that take more than 3 hours, or rows that pass either of two tests, like tasks owned by Lee or by Kim.
You join the tests with maths signs instead of words. Each test gives TRUE or FALSE for every row. Multiplying them keeps a row only when both are TRUE, and adding them keeps a row when at least one is TRUE.
How to write FILTER with more than one test
=FILTER(
- (test1)*(test2)
- Both tests must pass, the same as AND. Each test goes in its own brackets, like
(.B2:B8="Lee")
=FILTER(
- (test1)+(test2)
- Either test can pass, the same as OR. You can join three or more tests the same way.
FILTER with more than one test worked example
In D2, list Lee's tasks that take more than 3 hours.
| A | B | C | D | |
|---|---|---|---|---|
| 1 | Task | Owner | Hours | Lee, 3+ |
| 2 | Plan | Lee | 2 | Report |
| 3 | Survey | Kim | 8 | |
| 4 | Report | Lee | 6 | |
| 5 | Lee | 4 | ||
| 6 | Design | Kim | 5 | |
| 7 | Review | Ravi | 7 |
=FILTER( A2:A7, ( B2:B7="Lee") *( C2:C7>3))List the tasks where the owner is Lee and the hours are more than 3: Report and Email spill into D2 and D3. Plan is Lee's too, but takes only 2 hours.Common FILTER with more than one test mistakes
AND inside FILTER gives one answer or none
AND and OR look at the whole column and give back a single TRUE or FALSE. Use * for AND and + for OR, with each test in brackets.
A #VALUE! error after joining the tests
Without brackets, the multiply happens first and mixes up the tests. Put brackets around each test, like (.
Two tests on one column show nothing
A cell can't be Lee and Kim at once, so multiplying finds no rows. For either name, add the tests with + instead.
Multiply or add?
Ask whether a row must pass every test or any test. Every test: multiply with *. Any test: add with +. For a mix, like Lee's or Kim's tasks over 3 hours, put the added part in its own brackets and multiply that by the hours test.
This works in Microsoft 365, Excel 2021 or later and Google Sheets. Google Sheets also lets you give the tests as separate parts for AND, like FILTER(, but Excel needs the *.
Questions people ask
How do I FILTER with two conditions?
Multiply the tests, each in parentheses: =FILTER( keeps rows that pass both.
How do I FILTER with OR?
Add the tests instead: (B2:B9="Pune") keeps rows that pass either.
Why doesn't AND work inside FILTER?
AND gives one TRUE or FALSE for the whole range, not one per row. Multiplying the tests gives one answer per row.