How to eliminate zero value labels in a pie chart

rmccafferty

Board Regular
Joined
Jul 16, 2009
Messages
60
We have pie charts in a many tab workbook. The data in the charts (that is. the source of the chart's data) vary depending upon entries in other tabs. Usually we get a really nice pie chart with slices of different colors for various options and a label by each slice to tell the percent of the whole that it represents.

My problem is that sometimes, some of the results are a zero. In the pie graphic, that is not an issue and there just is no slice for that component.

BUT, this still generates a label showing 0%. Which appears to relate to nothing.

Is there any way to have any labels with a zero value not appear? Either not be generated to begin with, or be formatted so as not to be visible? I cannot find any settings anywhere in Excel that indicated that this is even possible, let alone tell how to do it. Of course we could deleted those labels when they are zero, but that would make the chart not work correctly the next time we use it.

We do not want to eliminate the zero value cell in the supporting "table." For a variety of reasons. (For starters, we want the client to see the table form of the data and we want the slices referring to each specific "variable" to always be the same color. I suspect other issues in formatting consistency would arise if we just removed a row of data.)

The chart is part of a financial planning workbook, with a lot of raw data entered about the person in an INPUT tab, and then all sorts of analyses and recommendations in additional tabs based upon the INPUT tab.

The point is that we would look to use the spreadsheet over and over again and would prefer not to have to manually format any part of the pie chart to cater to specific data input.
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
My first thought was to include the Category Names next to the labels so that it would show 0% against the category and it would be clear what the 0% referred to. However you can hide the 0% using custom number formatting. Right click the label and select Format Data Labels. Then select the Number tab and then Custom from the Categories. Enter

0%;[White][=0]General;General

in the Type box. This will set the font colour to white if a label has a value of zero. However Excel then tries to be clever by giving the label a black background so that you can read it!! So you then need to select the Font tab and set the background to Transparent. Click OK and it should give you what you want.

Hope this helps.
 
Upvote 0
One other thing, if you are showing the legend then your 0% series will still show there which might be confusing. The best option may be to go with my first thought and just add the Category Names to the labels.
 
Upvote 0
Have you tried making the label test for a value. eg.

=IF(E7,"label name","")

In this case E7 being the value.
 
Upvote 0
Number Kruncher:

The labels included in a pie chart are the % value of the applicable slice. Since they are labels just sort of hanging there, I have no idea where I would put the code.
 
Upvote 0
The answer of using a customer number format was perfect. I really did try to search the web first for the answer, but certainly did not find the source you pointed me to.

Thank you very much.
 
Upvote 0

Forum statistics

Threads
1,224,585
Messages
6,179,702
Members
452,938
Latest member
babeneker

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top