Slicers in Excel PivotTables

When Excel 2007 was introduced, the PivotTable Field List included a “Filter” area, where one could drop a field to use as a filter (for example, year, brand name, size, etc. from a block of sales data). If the user filtered for one year, or one brand, the name of the item was visible in the space above the body of the table. But if more than one item was filtered for, all it would say was “multiple items”…and not which ones. The feature worked, but couldn’t take this into account. So in Excel 2010, and all versions following, the Slicer feature was added. (No, I don’t know where they got the name. Sounded a little odd to me, too….)

Creating one or more slicers is dead simple. Make sure you’ve clicked somewhere in your PivotTable or –Chart, go to the PivotTable/Chart Tools Options tab, look in the Sort and Filter group, and click Insert Slicer.

Insert Slicer

You’ll need to choose which fields you want to filter with. Usually it’ll be at least a couple, one of which will often but not always contain values. And when you’ve selected, click OK.

Select Slicers

Done. Using the slicers is also easy. Click on the thing(s) you want to filter for (i.e. see), and they stay visible. Everything else hides.

But there is one neat extra tucked in there. Aside from the fact that the slicers print (they’re a WYSIWYG item), and you can resize them, you can change the number of columns of buttons per slicer, which means you can show more of them at once, and save some screen (and print) space.

Setting Columns

And that means you can use them to the fullest, because most of the time, any user who looks at your printout can see what you filtered for! No muss, no fuss.

Slicers are one of my more favorite features in Excel. They’re a good answer to a reasonable question (filters you can see and know what they’re filtering for), and they’re easy to use. They help content be more user-friendly, and even in a static situation (printout or PDF), they retain their usefulness.

How to Use COUNTBLANK in Excel

Some of the Excel functions, such as IF, come into play all the time, even outside business. They’re versatile and can do a lot. But others seem a little abstruse, or out in left field.

One question I occasionally get from business people in Excel is something like, “How do I make sure someone has filled in all the cells where I need data to, say, calculate an average correctly?” (Think “tax form” or W-4, for example. You want to make sure certain spaces are filled in regardless.)

In some situations, you might use a function like ISERROR, and incorporate it with IF to test if there IS an ERROR when you perform a calculation:

=IF(ISERROR(AVERAGE(D2:D10))…

…so that if performing the calculation glitches, you can have the formula show a message to this effect.

=IF(ISERROR(AVERAGE(D2:D10)),”There’s a blank cell there”…

Otherwise, perform the calculation.

=IF(ISERROR(AVERAGE(D2:D10)),”There’s a blank cell there”,AVERAGE(D2:D10))

Using ISERROR with AVERAGE

 

But this doesn’t quite solve the problem, because even if just one of the cells has data in it, there won’t be an error as far as Excel is concerned.

Formula finds one cell with data and calculates average

 

So we need to call a function that looks for ANY cells being empty, and lets us know. It’s called COUNTBLANK. (Sounds like some kind of strange nobleman–Count Blank, from some tiny hamlet somewhere….)

 

=IF(COUNTBLANK(D2:D10)>0,”Missing Data in D2 thru D10″,AVERAGE(D2:D10))

COUNTBLANK finds missing data and tells user

 

What it does is pretty simple, though. It COUNTs the BLANKs in a range, and can let us know how many there are. IF (as you see in the above formula) there are any (“COUNTBLANK(D2:D10)>0”), we want to see the TRUE result from the IF (the message about missing data); if not–that is, if the test is FALSE–then we want it to calculate the average. We’ve told the program to perform the calculation only IF the COUNT of BLANK cells is NOT greater than 0, and let us know if there are any blanks so we (or the user) can correct this.

COUNTBLANK finds no missing data

 

Of course, guaranteeing that only numbers get filled in is another matter. But there are a few different ways to take care of this, such as Data Validation. The important thing is, MISSING data are a problem, as the result isn’t an accurate one. And letting the user know about this is the big thing.