Can I hide a chart completely if there is no data for it?

bruty

Active Member
Joined
Jul 25, 2007
Messages
453
I have a spreadsheet which contain the results from some questionnaires we have. The way the data is broken down means each question has it's own graph and fed from the data and the spreadsheet is laid out in a way that fits 3 charts per page ready to be saved as a PDF.

It is split into 3 charts per page as that tends to fit the categories we have (3 questions per category), but some of the categories only have 2 questions. My query is, for those we no third question is there any way to hide the chart linked to that question as a whole?

The reason I need this is so I can just set up 1 tab as a template and then replicate that out as many times as required (new sections are added all the time), as I have it currently set up to read from 3 different cells for the question numbers relevant for that section and I don't want to have to mess around with remembering to remove a chart if there are only 2 questions.

(i.e. basically can I hide a chart (axis, gridlines etc) if there is no data where the chart is looking?)
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
I can't envision how exactly it is set up for you.

Are you using VBA at all?

You can simply hide the rows/columns that the chart is in. That may or may not work for you.
 
Upvote 0
No VBA is being used and trying to avoid it where possible.

It is set out with 3 charts underneath each other, say B2, B3 and B4. In C2:G4 is the data the charts are pulling from, so the chart in B2 reads from C2:G2 and so on. Basically, if there is no data in C4:G4, I want the chart in B4 to vanish.

VBA may be the only way to do it, in which case I will look into that, but just wondered if there was a different way, as the chart outline is there but it's blank and I just want the outline to go as well.
 
Upvote 0
No VBA is being used and trying to avoid it where possible.

It is set out with 3 charts underneath each other, say B2, B3 and B4. In C2:G4 is the data the charts are pulling from, so the chart in B2 reads from C2:G2 and so on. Basically, if there is no data in C4:G4, I want the chart in B4 to vanish.

VBA may be the only way to do it, in which case I will look into that, but just wondered if there was a different way, as the chart outline is there but it's blank and I just want the outline to go as well.

If you don't want to use VBA, you could probably "trick" Excel to do what you want using conditional formatting.

Get rid of the border around the chart.
Then use conditional formating in the cells around the chart to make a "fake" border if the data is present.
 
Upvote 0
If you don't want to use VBA, you could probably "trick" Excel to do what you want using conditional formatting.

Get rid of the border around the chart.
Then use conditional formating in the cells around the chart to make a "fake" border if the data is present.

Thanks for the idea, but that still won't get rid of the chart axis will it?
 
Upvote 0

Forum statistics

Threads
1,215,214
Messages
6,123,664
Members
449,114
Latest member
aides

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