Sub topic 12
Filtering visually with slicers
This chapter assumes you can create and name an Excel table, and that you know how the header-row filter buttons work. A slicer is a set of clickable buttons that filters a table. It shows the active filter on the sheet, so you don't have to open a drop-down list to see it.
What a slicer does
A slicer is tied to one column of a table. It lists each distinct value in that column as a button. Clicking a button filters the table to the rows with that value. Selecting several buttons shows rows that match any of them.
A slicer applies the same filter as the header drop-down for that column. The two stay in sync. If you filter with a slicer, the column's header button shows the filter icon. If you clear the filter from the header, the slicer clears too.
Slicers are useful when other people use your workbook. Someone who doesn't know the filter menus can still see which Region is selected and change it with one click.
Insert a slicer
- Click any cell inside the table.
- On the Table Design tab, choose Insert Slicer. You can also use Insert > Slicer.
- Tick the column or columns you want, for example Region.
- Click OK.
A slicer appears for each column you ticked. The slicer is a floating object. It sits above the cells and doesn't change the grid, so drag it to a free area beside the table.
Use the slicer
- Click one button to show only that value.
- Hold Ctrl and click to add or remove individual values.
- Hold Shift and click to select a run of adjacent buttons.
- Click the funnel icon with the red cross, at the top right of the slicer, to clear the filter.
When a filter is active, the status bar shows a message such as "12 of 240 records found".
Combine slicers
You can add one slicer per column and use them together. The filters combine with AND logic. With Region set to West and Product set to Widget, the table shows only rows that satisfy both.
Excel also dims the buttons that would return no rows given the other filters. This lets you see at a glance which combinations exist.
Format and arrange a slicer
Select the slicer to open the Slicer tab on the Ribbon. From there you can:
- Choose a color style.
- Set the number of columns, so a long list of buttons lays out as a compact grid.
- Resize the buttons and the slicer.
- Change the caption through Slicer Settings.
Use Slicer Settings to hide the header, sort the buttons, or control how items with no data are shown.
Slicers and formulas
Rows hidden by a slicer are filtered out, so functions that ignore filtered rows respond to it. This is why the total row uses SUBTOTAL, as in the formula below. The 109 argument sums only visible rows.
=SUBTOTAL(109,SalesTable[Amount])A plain =SUM(SalesTable[Amount]) ignores the filter. It keeps returning the grand total whichever slicer buttons are selected. If a number beside your slicers looks wrong, check which function produces it.
Common problems
| Symptom | Likely cause | Fix |
|---|---|---|
| Insert Slicer is greyed out | The active cell is outside the table, or the workbook is in an old file format | Click inside the table. Save the file as .xlsx |
| A new value is missing from the slicer | The slicer needs a refresh after the data changed | Reapply the filter or re-select the table. New values then appear |
| A slicer hides the data it covers | The slicer sits on top of cells | Move it beside the table |
| The slicer is lost after converting the table to a range | Table slicers need a table | Keep the table, or filter the range by hand |
Exercise
A table named SalesTable has a Region slicer with West selected. Cell F1 holds =SUM(SalesTable[Amount]) and cell F2 holds =SUBTOTAL(109,SalesTable[Amount]). Which cell changes when you click a different Region button, and why?
Show answer
Only F2 changes. SUBTOTAL with function number 109 ignores rows hidden by a filter, so it follows the slicer. SUM adds every row in the column, so F1 keeps showing the grand total.
Exercise
You want to show rows for either West or East. How do you select both buttons on one Region slicer?
Show answer
Click West, then hold Ctrl and click East. The table then shows rows that match either value.