Hide data series on legend depending on values

hannahbarton

New Member
Joined
Aug 7, 2015
Messages
9
I have a line chart where the data behind uses formulas to populate the values. Sometimes there aren't values for a particular month so I've use the N/A# error to stop these plotting. However, I'd like to be able to remove certain data series from the legend if EVERY value is N/A#.

I've seen some solutions where users are suggesting text boxes as opposed to the actual chart legend, but this really doesn't work for what I am trying to produce (can explain why if necessary).

Some VBA would be brilliant! I can use the basics of VBA but am a complete beginner so please can replies be idiot-proof :)

Excel Version = 2013

(I've found SIMILAR questions through some extensive searching but none which quite give an adequate response. Sorry if this is counted as a repeat question though!)

Thank you in anticipation!!!
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
Hi Steve
Thanks for your response!
It's actually a table looking up values from a pivot table (using getpivotdata). It's pretty longwinded but it was a lot easier for me to do it like that due to the way I needed to manipulate the data from SQL. So my slicers are throwing me off... they work as normal (if the slicer option isn't selected, it doesn't appear in the pivot table, the new data table for the chart shows n/a therefore not plotted) it's just the legend that's still there!
Hannah
 
Upvote 0

Forum statistics

Threads
1,216,073
Messages
6,128,634
Members
449,460
Latest member
jgharbawi

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