+ Reply to Thread
Results 1 to 16 of 16

Line graph to ignore plot area with zero values

  1. #1
    Forum Contributor heytherejem's Avatar
    Join Date
    07-06-2017
    Location
    Hampshire, England
    MS-Off Ver
    2016
    Posts
    152

    Line graph to ignore plot area with zero values

    Hi experts,

    Attached is one of several line graphs that need to be updated each month. They use the range which I've highlighted in yellow which is a percentage. At present, we manually move the plot range forward one each month. There are about 100 line graphs so this takes some poor shmuck half day of dragging range lines.

    So... I'm trying to get excel to do it all for me.

    So far, I've updated the range till the end of 2017 and created an iferror formula so the percentage cell is blank if there is nothing to calculate. But as you can see, my line graph has dropped to zero for these months. Is there a way I can tell the graph to ignore blank cells?
    Or can you think of another solution?

    The main issue is, next year I want to create 2018 in it's entirety and I really only want the graph to plot the months with data in them - I don't want a massive blank space at the end where it's waiting for data.

    I hope this makes sense!

    Jemma
    Attached Files Attached Files

  2. #2
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,147

    Re: Line graph to ignore plot area with zero values

    hi there. for the charts to ignore the value, it has to be NA. you could use this in cell L57 for eg:
    =IFERROR(L54/L$53,NA())

    apply this logic to the rest too

    Thanks, if you have clicked on the * and added our rep.

    If you're satisfied with the answer, click Thread Tools above your first post, select "Mark your thread as Solved".

    "Contentment is not the fulfillment of what you want, but the realization of what you already have."


    Tips & Tutorials I Compiled | How to Get Quick & Good Answers

  3. #3
    Forum Contributor heytherejem's Avatar
    Join Date
    07-06-2017
    Location
    Hampshire, England
    MS-Off Ver
    2016
    Posts
    152

    Re: Line graph to ignore plot area with zero values

    Hi Beni,

    Thanks that's worked! So does:
    Please Login or Register  to view this content.
    which I found out by accident!

    But... my graph still has the horizontal axis range showing to the end of the year (although now there's nothing plotted there). Which is ok for 2017 as there's only 2 months left so it looks ok, but next year I will have 12 months of blank space.

    Is there a way of having the graph know when to change it's own range? Or could a macro be used to update the ranges of all the graphs at once each month?

    Thanks

  4. #4
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,829

    Re: Line graph to ignore plot area with zero values

    Is there a way of having the graph know when to change it's own range? Or could a macro be used to update the ranges of all the graphs at once each month?
    What you are looking for is a "dynamic named range", and there are many tutorials across the internet describing their use.
    https://trumpexcel.com/dynamic-chart-range/
    https://www.techrepublic.com/blog/mi...arts-in-excel/
    https://chandoo.org/wp/2009/10/15/dy...t-data-series/

    They all use the OFFSET() function to build the dynamic range: https://support.office.com/en-us/art...e-b4d906d11b66
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  5. #5
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Line graph to ignore plot area with zero values

    Using your existing IFERROR formula, the attached shows dynamic named ranges for each year (you can review them in Formulas- Name Manager). Hopefully it is fairly self explanatory, but let me know if not.
    Attached Files Attached Files
    Don
    Please remember to mark your thread 'Solved' when appropriate.

  6. #6
    Forum Contributor heytherejem's Avatar
    Join Date
    07-06-2017
    Location
    Hampshire, England
    MS-Off Ver
    2016
    Posts
    152

    Re: Line graph to ignore plot area with zero values

    @xlnitwit - I can see that your document works exactly how I want it to (thanks!!) but I cannot see what you've done to make it this way.
    If you would be so kind as to explain how you did it I can apply this across the rest of the datasets

    Thanks so much for helping me with this!

  7. #7
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Line graph to ignore plot area with zero values

    If you click the Formulas tab and then Name Manager, you will see the named ranges for the 4 series- Series_2014, Series_2015 and so on- and the formulas that they use to only include the cells with numbers in.

    I cleared the existing data from your chart and then added those series one by one (via the Select Data dialog).

  8. #8
    Forum Contributor heytherejem's Avatar
    Join Date
    07-06-2017
    Location
    Hampshire, England
    MS-Off Ver
    2016
    Posts
    152

    Re: Line graph to ignore plot area with zero values

    Hi xlnitwit - so if I want to do this across the other datasets, do I go to Name Manager and create four new series and apply the formulas you have used?

    And then when I re-create the graphs, how do I select the range as you have? I can see when I use the Select Data dialog the 2014 range says this:
    ='550830d1512570103-line-graph-to-ignore-plot-area-with-zero-values-triangles.xlsx'!Series_2014

    - forgive my ignorance I've never done this before!!

  9. #9
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Line graph to ignore plot area with zero values

    Quote Originally Posted by heytherejem View Post
    Hi xlnitwit - so if I want to do this across the other datasets, do I go to Name Manager and create four new series and apply the formulas you have used?
    Yes, assuming the other sheets have the same layout.

    And then when I re-create the graphs, how do I select the range as you have? I can see when I use the Select Data dialog the 2014 range says this:
    ='550830d1512570103-line-graph-to-ignore-plot-area-with-zero-values-triangles.xlsx'!Series_2014
    Create a blank chart, then right-click and choose Select Data. Then use the Add button to add new series, entering the relevant name and then the formula for the Values. Repeat for each series. It is a little bit fiddly and time-consuming initially but should save you time in the long run.

  10. #10
    Forum Contributor heytherejem's Avatar
    Join Date
    07-06-2017
    Location
    Hampshire, England
    MS-Off Ver
    2016
    Posts
    152

    Re: Line graph to ignore plot area with zero values

    One more question about the graph.

    The formula for the Series values... I am not selecting the range, right? How did you get it to pick up the range - do I just type the same info you have done '=filename!seriesname' ?
    Last edited by heytherejem; 12-06-2017 at 01:03 PM.

  11. #11
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Line graph to ignore plot area with zero values

    You have to type it in. Two tips to speed that up-
    1. Use the sheet name rather than the workbook name- i.e. enter ='Sheet name'!Series_2014 (Excel will convert it to the workbook name for you later)
    2. When you do the first one, copy the formula so that you can paste it in for the others and just change the number at the end.

  12. #12
    Forum Contributor heytherejem's Avatar
    Join Date
    07-06-2017
    Location
    Hampshire, England
    MS-Off Ver
    2016
    Posts
    152

    Re: Line graph to ignore plot area with zero values

    You, are a legend. I will work on this tomorrow and hopefully it will be plain sailing, if I get stuck, you may hear from me again!

    You've been incredibly helpful xlnitwit thank you SOOOOO MUCH!!!! Not such a nitwit.

  13. #13
    Forum Contributor heytherejem's Avatar
    Join Date
    07-06-2017
    Location
    Hampshire, England
    MS-Off Ver
    2016
    Posts
    152

    Re: Line graph to ignore plot area with zero values

    @xlnitwit.... I'm stuck.

    I've gone through and created all the name manager ranges, and then when I've come to enter the range name in the chart series value, it comes up with an error saying it's not valid.

    I've attached a copy of my working document, I've got all the calculations on one tab, and the charts which point to the calculations on a second tab.

    I've taken a screenshot of what I entered in the chart series box that excel didn't like (on the screenshot tab) - any ideas where I've gone wrong???

    Jemma
    Attached Files Attached Files

  14. #14
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Line graph to ignore plot area with zero values

    Your 2014 series formula is wrong as it starts with B15 but then indexes into row 36.

  15. #15
    Forum Contributor heytherejem's Avatar
    Join Date
    07-06-2017
    Location
    Hampshire, England
    MS-Off Ver
    2016
    Posts
    152

    Re: Line graph to ignore plot area with zero values

    Quite right, that I did. I was just testing your attention to detail!
    Seems to be working now, only 99 more to go

  16. #16
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Line graph to ignore plot area with zero values

    You might want to consider creating a separate table of formulas linking to the original data to create your charts from. I suspect it would greatly speed things up. Or perhaps use some code.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Making a line graph into a curve graph & finding the area
    By AppleMonster in forum Excel Charting & Pivots
    Replies: 5
    Last Post: 03-28-2014, 05:37 AM
  2. [SOLVED] HOW TO? area (background of a scatter plot (graph))
    By corriere in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 01-17-2014, 10:42 AM
  3. [SOLVED] 100% Stacked Bar Graph with Label in the center of the Plot Area
    By codeslizer in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 07-15-2013, 05:05 AM
  4. Line Graph - Do plot zero, Don't plot #NA
    By Janc in forum Excel Charting & Pivots
    Replies: 5
    Last Post: 04-01-2012, 05:45 PM
  5. Line span across plot area and avoid zero during avg.
    By rr1050 in forum Excel Formulas & Functions
    Replies: 12
    Last Post: 01-17-2009, 03:56 AM
  6. Shading / coloring a target area on a line plot
    By anagaraj1 in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 07-16-2008, 02:57 PM
  7. Replies: 1
    Last Post: 04-11-2006, 12:50 PM
  8. Replies: 0
    Last Post: 06-03-2005, 09:05 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1