Filter with a criteria range using Advanced Filter
Work with long lists10 minPremium
Builds on Filter a list to the rows you need.
A credit controller in Lisbon pulls two kinds of invoices for the weekly call: Lisbon invoices over €5,000, and every invoice from Porto. The filter buttons join conditions on different columns with AND only, so she uses Advanced Filter.
How it works
Advanced Filter (Data > Advanced) reads its conditions from cells on the sheet, called a criteria range. Its first row repeats column headings from the list, spelled the same way. Each row under them is one way for a list row to match: conditions on the same row must all hold, and a list row that matches any one criteria row shows.
| Row | A | B |
|---|---|---|
| 1 | In a criteria cell | Matches |
| 2 | Porto | text that begins with Porto |
| 3 | ="=Porto" | Porto and nothing longer |
| 4 | >5000 | numbers over 5,000; >=, <, <= and <> work too |
| 5 | nothing | anything |
To set two limits on one column, put its heading in the criteria range twice, side by side, with one limit under each.
In the dialog, set the List range and the Criteria range. Then either filter the list in place, or choose Copy to another location and give the cell where the copy should start. Unique records only leaves out repeated rows. Advanced Filter runs once, so after the data changes, run it again.
Example
The controller's criteria range is A1:B3, above the list, with an empty row between them.
- Step 1: The criteria range
A1:B3repeats the headings Branch and Amount from the list. - Step 2: Row 2 matches Lisbon invoices over €5,000, because both its conditions must hold.
- Step 3: Row 3 is another way to match, so every Porto invoice shows too.
- Step 4: Lisbon's invoice for exactly €5,000 isn't over €5,000, so row 11 is left out.
Keep the criteria range above the list, as here. A filter in place hides whole rows, and a criteria range beside the list could disappear along with them.
Common mistakes
- A criteria range that takes in an empty row matches every row of the list. Select only the heading row and the rows you filled in.
- Conditions on separate rows are alternatives. Two limits on one column, such as
>=and500 <=, go side by side under the heading typed twice; on two rows, every value passes one of them.2000 - Plain text matches the start of a value, so North also finds Northeast. Type
="=North"to match North alone. - Copy to another location copies only to the sheet you're on. To put the results on another sheet, start Advanced Filter from that sheet.
In short
- A criteria range repeats the list's headings, with conditions under them.
- Conditions on the same row must all hold; each further row is another way to match.
- Type
="=North"to match text exactly, and repeat a heading to set two limits on one column. - Keep empty rows out of the criteria range, and run Advanced Filter again after the data changes.
Practice
Premium5 exercises: 1 sheet edit and 4 sorts and filters.
Practice is part of Premium
Every lesson is free to read, and you can practice the free lessons without an account. This lesson's exercises are part of Premium, which you add to a free account.
Have one? Sign in