Sub topic 7
Filter by values or by condition
This chapter assumes you have the Data sheet from the earlier chapters: a flat table in A1:F with the headers Order ID, Order Date, Region, Category, Units, and Revenue. It also assumes you can add a slicer and set its data range and column. Here you will learn the two ways a slicer decides which rows to keep, and when to use each.
How a slicer filter works
A slicer is tied to one column of one data range. Its filter tests every row in that column and hides the rows that fail the test. Charts, pivot tables, and SUBTOTAL cells that the slicer controls then recalculate from the remaining rows.
A slicer offers two kinds of test:
- Filter by values shows the distinct values in the column. You tick the ones you want to keep.
- Filter by condition applies a rule such as "greater than 200" or "text contains West". Rows that satisfy the rule stay.
To switch between them, click the slicer's filter button (the dropdown on the slicer itself). Choose Filter by values or Filter by condition and expand it. The slicer stores one active filter. The rest of this chapter shows how to choose well.
Filter by values
Filter by values suits columns that hold a small set of repeated labels, such as Region or Category. It works like this:
- Select the slicer, then open its filter dropdown.
- Expand Filter by values. The slicer lists each distinct value in the column.
- Use Select all and Clear to set every box at once. Then tick or untick individual values.
- Use the search box to narrow a long list before ticking.
- Click OK.
With only West ticked in a Region slicer, the sample data keeps order 1001 and hides 1002 and 1003. A KPI cell such as =SUBTOTAL(109, Data!F2:F1000) then returns 450.
Things that go wrong with values lists
The list is built from what is in the column, so dirty data produces a dirty list.
WestandWest(with a trailing space) appear as two entries.westandWestcan also appear as separate entries, depending on how the values were typed.- Empty cells appear as a blank entry. If you clear it, the slicer hides every row with no value in that column.
Fix these in the source table, not in the slicer. Chapter 2's rule of one clean value per cell is what makes this list usable. A quick check is to list the distinct values yourself:
=SORT(UNIQUE(Data!C2:C))If this shows near-duplicates, correct them in Data first.
When values stop working well
A values list is a poor fit for columns with many distinct values. Order ID has one per row, and Revenue has nearly one per row. A list of hundreds of checkboxes is not a usable control. Use a condition filter on those columns, or choose a different column for the slicer.
Filter by condition
Filter by condition applies a rule to each cell in the column. The rule types depend on the column's content.
| Rule family | Examples | Typical column |
|---|---|---|
| Emptiness | Cell is empty, Cell is not empty | Any |
| Text | Text contains, Text does not contain, Text starts with, Text ends with, Text is exactly | Region, Category |
| Date | Date is, is before, is after, is between | Order Date |
| Number | Greater than, Less than, Equal to, Between, Not between | Units, Revenue |
| Formula | Custom formula is | Any |
The exact wording of the menu can differ slightly between Sheets versions. The families stay the same.
Number rules
Number rules keep rows by size. A condition of Greater than or equal to 200 on the Revenue column keeps orders 1001 (450.00) and 1003 (300.00) and hides order 1002 (120.00). Every chart and KPI that the slicer controls now reflects only those two orders.
This works only if the column holds real numbers. A revenue cell stored as text, such as '450.00, is compared as text. It can be skipped or compared in the wrong order. Check that the column is right-aligned by default and that =ISNUMBER(Data!F2) returns TRUE.
Text rules
Text rules are useful when labels share a pattern. Suppose Category contains Hardware, Hardware - Accessories, and Software. The rule Text contains Hardware keeps the first two. A values slicer would make you tick both by hand, and it would miss any new Hardware - ... label added later. A text rule keeps matching new rows automatically.
Text rules are also the right tool when you want one slicer that behaves like a search box. The viewer edits the condition's text and the dashboard updates.
Date rules
Date rules need a column of real dates, not text that looks like dates. The date types are covered in detail in the next chapters. For now, remember two things:
- Date is after
2026-01-31keeps February and later. - Date is between two dates keeps a window. Both ends are part of the rule, so choose them with care.
If a date rule hides everything or nothing, the column probably holds text. Test with =ISDATE(Data!B2) or =ISNUMBER(Data!B2).
Custom formula rules
Custom formula is lets you write a test that returns TRUE or FALSE for each row. Use it for anything the built-in rules cannot express, for example combining two conditions on one column:
=OR(C2="West", C2="East")The formula is written relative to the first data row of the slicer's column, and Sheets applies the same pattern to every row. Test any custom formula on a small sample before you rely on it. A formula that returns an error for some rows will usually hide them.
A custom formula can only test the cell in its own column unless you refer to other columns of the same row. This can work, but it hides the logic from viewers, because the slicer only displays the formula. Prefer a helper column in Data when the rule is complicated, then use a values slicer on that helper column.
Choosing between the two
| Question | Use values | Use condition |
|---|---|---|
| Does the column hold a short list of labels? | Yes | Possible, but slower for viewers |
| Do viewers need to pick several exact items? | Yes | No |
| Do you need "at least", "before", or "between"? | No | Yes |
| Should new matching rows be included automatically? | Only if the value already exists in the list | Yes |
| Is the column an ID or a continuous number? | No | Yes |
Viewers find checkboxes quick to use. They find conditions more flexible but harder to read, because the current rule sits inside the dropdown. If the dashboard is for people who will not open a dropdown, set the slicer's title to say what it does, for example "Revenue at least".
Filters hide rows, and what that means for your formulas
Both kinds of filter hide rows in the data range. They do not delete them. This is why SUBTOTAL follows the slicer: codes 101–111 ignore filtered-out rows, and so do the 1–11 codes in a filtered range. The SUM function does not. Review the KPI formulas from the sample plan:
=SUBTOTAL(109, Data!F2:F1000)
=SUBTOTAL(103, Data!A2:A1000)
=IFERROR(SUBTOTAL(109, Data!F2:F1000) / SUBTOTAL(103, Data!A2:A1000), 0)With the Revenue condition above (at least 200), these return 750 total revenue, 2 orders, and 375 average order value. With a condition that matches nothing, the IFERROR returns 0 instead of a divide-by-zero error.
A pivot table or chart sits on a separate layer. It follows the slicer only if the slicer is connected to it. That is the topic of the next chapter.
Common mistakes
- Expecting values to update the list. If you correct a typo in
Data, reopen the slicer's dropdown to see the new list. - Leaving an old condition active. A forgotten rule can make a dashboard look empty. Look at the slicer's current state before you assume the data is missing.
- Using the wrong column. A slicer filters one column. To filter by Region, the slicer must be set to the Region column, even if its title says "Region".
- Mixing text and numbers in one column. The rule menu may offer the wrong family, and results become unpredictable.
- Choosing a range too short. A data range such as
Data!A1:F100ignores row 101 onward. Use an open-ended range such asData!A1:Fso new rows are included.
Practice with the sample data
Try these on the Data sheet from the plan.
- Add a slicer on Region. Use Filter by values and tick only East. Note the Total revenue KPI. It should be 420.
- Switch the slicer to the Revenue column and use Filter by condition with Greater than 200. Note which orders remain.
- Switch to the Order Date column. Use Date is after
2026-01-31. Confirm that only orders from February remain. - Reset every filter.
Exercise
A Category slicer uses Filter by values. Your team adds a new category, "Hardware - Accessories", next month. You want the dashboard to include every category that starts with "Hardware" without anyone editing the slicer. Which filter type fits, and what is the rule?
Show answer
Use Filter by condition on the Category column with the rule "Text starts with" and the text "Hardware". The rule matches any current or future label that begins with "Hardware". A values filter would only show ticked items from the list and would need a manual change each time a new label appears.
Exercise
Your slicer on the Revenue column has the condition "Greater than 200", yet the KPI shows revenue for rows where Revenue is 120. List two possible causes.
Show answer
First, the slicer may not control the range the KPI reads, for example if the KPI formula points at a different range than the slicer's data range. Second, the KPI may use SUM instead of SUBTOTAL, so it counts hidden rows too. A third cause is that Revenue values are stored as text, so the comparison does not behave as a number test.