Microsoft Excel is a spreadsheet program that is part of the Office 365 Suite and has been the traditional reporting tool for businesses. Although I know that many companies are slowly shifting their reports to Power BI because it offers powerful analytics and reporting features, I still see Excel as a great tool to present data in a compelling way.
In this tutorial, I will explain how to create some interaction using slicers to filter data in Excel.
A slicer is an object in Excel that allows you to filter data in the form of an interactive buttons.
Slicers provide buttons that you can click to filter tables, or PivotTables. In addition to quick filtering, slicers also indicate the current filtering state, which makes it easy to understand what exactly is currently displayed
Source: Microsoft Office Support - Use slicers to filter data
The slicer shows all the different values for a selected column and each is displayed as a button inside the slicer. You can click on the buttons to active and deactivate a filter from your data set. It floats above the grid of the spreadsheet and is always visible for use.
Slicers were introduced for Pivot Tables in Excel 2010 for Windows, for Tables in Excel 2013 for Windows. It was introduced to Excel for Mac only it the 2016 version.
As mentioned in the Microsoft’s description above, a slicer can be used with a Table and a Pivot Table.
To add a slicer to a Table, you need first a table. To create a table from a common spreadsheet data, use the following steps:
And the table is ready.
With the table ready, adding a slicer is very simple. Just click on Table Design [1] and later at the button Insert Slicer [2].
Select the columns you would like to use as a filter and press OK. Resize and move the slicers to an appropriate location on the spreadsheet and you are ready to use the slicer.
Below is a quick step-by-step guide to create a simple Pivot Table, so I can show you how to add a slicer:
And the PivotTable is ready.
In this example, I am using data extracted from the Sakila Sample Database of MySQL. The simple PivotTable shows the number of movies for each category.
To add a slicer for a Pivot Table is also very simple:
We now see the number of movies per category and we can filter according to the rating.
In such a simple pivot table, the slicer could be seen as irrelevant, since we can use the filter (see screenshot below). However, when selecting multiple values, the filter will display “Multiple Items”, but we can see the filtered items using the slicer. Filtering using the slicer is also just a button click. A bigger difference between filter and slicer is that the slicer can be connected to multiple pivot tables and pivot charts, while filters are linked to one pivot table.
For me, slicers are great when using with pivot charts. The screenshots sequence below shows a small part of an Excel automated daily report I created years ago for Project Mustang, which demonstrates the use of slicers with pivot charts.
Disclaimer: The data that appears in the screenshots above has been manipulated for presentation purposes and confidentiality reasons.
Using a slicer is simple and you can select the items the same way you select cells in a spreadsheet. First, let us have a look at the objects of a slicer:
Note: I manipulated Sakila’s original data by changing all Horror movies with the G and PG rating to PG-13 in order to display the slicer above.
To select one item in a slicer, click on the item. When you do this, you are applying a filter and you will only see data for this item.
You press and hold the Ctrl key, then you click on the items to select or unselect them.
To select multiple adjacent items, you have 2 options:
Excel provides an easier way to select multiple items by using the “Multi-Select” mode. Click on the “Multi-Select” button in the upper right hand corner of the slicer (next to the Clear button) to enable multi-select.
You can unselect all items (reset the filter) from a slicer by clicking at the “Clear” button located at the top right corner of the slicer.
The look of a slicer can be customized. To change the default blue color, do the following:
You can further customize it by creating new slicer styles. Click on “New Slicer Style…” [4] and you will see many options to choose from.
After adding a pivot chart, making some quick adjustments and creating a new slicer style, we have:
I hope this tutorial will help you use slicers in Excel. Thanks for reading and come back in future to see new posts!