LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 38
Default I can get line chart to ignore zeros but the legend still contains

Can you not just use an autofilter to filter out the rows which are
blank? (based on an extra column which checks all the previous columns,
or a simple SUM of them perhaps).

If you do want to automate it based on something changing, or giving the
user a button for this, then the one line macro below should do the
trick - this filters the fourth column of your table, adjust the 4
according to your needs.


ActiveSheet.Range("$C$7:$F$13").AutoFilter Field:=4, Criteria1:="<0",
Operator:=xlAnd


If your data can be brought across in a suitable layout then a
PivotChart might be a better option to ignore data that does not occur
in the source.

Hope this helps.
Adam

On 05/03/2010 21:04, jaimeo wrote:
I am using Excel 2007.

Thanks




"jaimeo" wrote:

Hi,

I have a table linked to a series of worksheets. The table shows products 1
to 6 in cells A2:A8. It then shows sales for each year in b2, c2. c3 etc.
for product 1. b3, c3 etc for product two and so on.

It is designed to show products sold in lots of different countries. I have
a line chart linked to the table. It works fine if all six products are sold
in the country. If they are not then because Product 1-6 is always entered
even if not all products are sold the legend still shows them all. I have
tried NA'ing the cells which stops them being charted but the legend entry
remains. I tried returning a blank cell if the values for the series were
all 0 but the legend entry was still there, just blank but still assigned a
colour. I even tried deleting the data out of the cells entirely so they
were genuinely totally blank but the legend still picks it up.

I only need it to ignore a product if every value in the series of figures
for turnover is 0 (i.e. we do not sell it in that country). There are 120
possible charts that can be produced from the table so I am hoping to
automate it. Originally I thought maybe I should use the conditional
formatting posts I have seen around to do it. However, when I pass this work
to someone else there is a good chance they may decide they want the graph
colour design to have a different colour background thereby highlighting what
conditional formatting would have hidden.

What I am leaning towards now is a way to effectively say "if all values in
this series are 0 then ignore it entirely" with the option then that if in
the future we launch that product the chart then recognises the values are no
longer zero, I can rerun the code or whatever and it will prepare me the
correct chart.

Apologies for the long winded response. I am very much a VBA beginner and
even an Excel beginner but I am learning a lot as I dig into this.

Please advise if you can.

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How delete the legend in a line chart John Charts and Charting in Excel 1 October 12th 09 04:22 AM
How do I show a data table with legend keys in a line chart? excelbanker Charts and Charting in Excel 1 October 31st 08 04:31 AM
excel 2007 line weight in legend does not match the chart JRob Charts and Charting in Excel 0 June 16th 08 01:06 AM
getting chart legend to ignore #NA s! arran1180 Excel Discussion (Misc queries) 3 December 20th 06 02:31 PM
auto show a line on a chart by clicking on a legend key Patrick Gomes Charts and Charting in Excel 0 September 1st 06 05:07 PM


All times are GMT +1. The time now is 04:49 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"