+ Reply to Thread
Results 1 to 12 of 12

Line Chart Question - break in line for blank cells

  1. #1
    Registered User
    Join Date
    03-24-2006
    Location
    Stafford, England
    MS-Off Ver
    Office 2003
    Posts
    70

    Line Chart Question - break in line for blank cells

    I have a line chart that I need to be able to provide a break in the line if there is a blank cell. At the moment it does not plot anything for the blank cell but it does draw the line from the last plotted cell to the next plotted cell after the blank.

    Hope this makes sense. Anyone have any ideas without having to do it manually?

    Thanks
    Jonathan

  2. #2
    Forum Expert
    Join Date
    08-27-2008
    Location
    England
    MS-Off Ver
    2010
    Posts
    2,561

    Re: Line Chart Question - break in line for blank cells

    #N/A values aren't plotted

    either manually enter =na() or use it in a formula, like:
    =if(A1=0,na(),A1/3)

  3. #3
    Registered User
    Join Date
    03-24-2006
    Location
    Stafford, England
    MS-Off Ver
    Office 2003
    Posts
    70

    Re: Line Chart Question - break in line for blank cells

    Cheeky Charlie,

    Thanks for replying. The problem is not that it is plotting the value (I am already using =NA()), it is that the line is still carrying on between the last plotted value and the one that appears after the NA cell.

    Jonathan

  4. #4
    Forum Contributor Lotus123's Avatar
    Join Date
    11-07-2005
    Location
    Texas
    MS-Off Ver
    2007
    Posts
    153

    Re: Line Chart Question - break in line for blank cells

    Jonathan:

    You will find differrent graphs do different things with #N/A. For example, bar and area graphs will "skip" the #N/A. Some graphs will substitute zero for #N/A.

    For your sitatuon, since the line is not showing a break, I suspect you are using the basic standard line graph. It will not plot a point for #N/A, but it will draw from the prior point to the next. For this line chart you should use NULL (which is different than blank or "") instead of #N/A.

    You may find if you simply delete or clear the entry from your graph then you will get a break in your line; however, there is no way, via formula, to return a NULL or empty cell (of which I am aware). For this reason I usually use area charts or bar graphs (which correctly use #N/A).

    I have uploaded an example for your review.
    Attached Files Attached Files
    Ecce Potestas Casei
    Nathan Head

  5. #5
    Forum Expert
    Join Date
    08-27-2008
    Location
    England
    MS-Off Ver
    2010
    Posts
    2,561

    Re: Line Chart Question - break in line for blank cells

    Sorry, I didn't understand the problem straight away.
    Google AndyPope.info for an example of how to deal with exactly this.

    CC

  6. #6
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: Line Chart Question - break in line for blank cells

    JonPugh, you need to tell Excel what to do with NA cells.

    click the chart, go Tools - Options - Chart tab and select "plot empty cells as - not plotted" instead of "interpolated"

    Interpolated will connect the datapoints, not plotted will leave gaps.

    hth

  7. #7
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,431

    Re: Line Chart Question - break in line for blank cells

    For a line #N/A will only remove the data marker.

    The line will be interpolated for #N/A using the nearest real data values to the left and right. This means a line can be truncated by using #N/A but you can not create gaps. Only true empty cells will create gaps.
    This over rides the settings of Leave Gaps, Interpolate and As Zero. Those settings only apply to empty cells.
    Cheers
    Andy
    www.andypope.info

  8. #8
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: Line Chart Question - break in line for blank cells

    Quote Originally Posted by Andy Pope View Post
    For a line #N/A will only remove the data marker.

    The line will be interpolated for #N/A using the nearest real data values to the left and right. This means a line can be truncated by using #N/A but you can not create gaps. Only true empty cells will create gaps.
    This over rides the settings of Leave Gaps, Interpolate and As Zero. Those settings only apply to empty cells.
    Thanks for the clarification, Andy. One thing to mark on the "things I learned today" chalk board.

    But to clarify: if the cell's value is determined by a formula, what would that formula have to return to simulate a truly empty cell in order to enable gaps in a line chart? Obviously not

    =If(condition,value,NA())

    and not

    =IF(condition,value,"")

    Any tricks up your sleeve?

    cheers

  9. #9
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,431

    Re: Line Chart Question - break in line for blank cells

    There in lies the problem. There is nothing that can be returned to say "ISEMPTY". It's a feature we have asked MS to provide.

    If your data is not too complicated you can try
    http://www.andypope.info/charts/brokenlines.htm

    Otherwise VBA to clear the cells is the only other option.

    Or I guess you could use multiple series to plot the segments.

  10. #10
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: Line Chart Question - break in line for blank cells

    It's a feature we have asked MS to provide.
    That explains it! Thank you. Especially for Time to study the masters and learn!

    have a good day!

  11. #11
    Forum Expert
    Join Date
    08-27-2008
    Location
    England
    MS-Off Ver
    2010
    Posts
    2,561

    Re: Line Chart Question - break in line for blank cells

    ^Yah that's the link I was too lazy to find!

  12. #12
    Registered User
    Join Date
    03-24-2006
    Location
    Stafford, England
    MS-Off Ver
    Office 2003
    Posts
    70

    Re: Line Chart Question - break in line for blank cells

    A bit late (been on leave) but thanks to everyone who contributed to this thread.

    Jonathan

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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