Originally Posted by
MrShorty
This may not be popular on an Excel forum, but I opened your file in LibreOffice Calc, and it looked correct. As you note, even with the "leave blanks as gaps" setting, Excel draws a line across the interior N/A's. LO Calc's chart engine left gaps over the N/A's. In this respect, it seems that LO Calc has a superior "leave blanks as gaps" charting algorithm. Of course, switching spreadsheet applications will create other problems (I often find that Excel and Calc's charting engines are not easily compatible with each other), so switching applications may not be a good choice. However, it appears to be a quick and easy solution for the specific problem in the specific sample file attached.
How automated does your solution need to be? As noted, this is a "bug/feature" of how Excel interprets the hidden and empty cells setting related to non-empty N/A cells. If any of those offending N/A cells was truly blank, then Excel would leave a proper gap in the chart. In your file, I selected E12 and pressed delete, then F17 and pressed delete, and the extra lines disappeared from the chart. It was quick and easy for the specific example given, even if it did require manual input. It will be easy to refill those two cells in for future data sets, and then delete a few cells as needed. This doesn't bode well for larger data sets or for data sets that are more complex -- especially if they result in many extra lines on the chart. This is simple and easy, but will become tedious for larger, more complex data sets -- like when expanding the data range to include all 2000 rows. Judge for yourself whether this is easier than trying to come up with a fully automatic solution.
I expect that a fully automatic solution is going to involve expanding the existing solution so that the formulas will recognize each "gap" in the individual data sets, and add each unique segment as a separate column/data series. I have not explored exactly what this formula would need to look like, nor have I searched your full data set to see how many different columns/data series would be needed. In the end, it amounts to the same basic approach, except that the "logic" behind the formula necessarily becomes more complex. If you need to explore this, let us know and we can look at it.
The previous approach (each color added as a separate data series) is most common because it is considered easier than having VBA format each segment/point of the original, full data series. With this kind of complexity, it may become easier to write a VBA macro that will do the conditional formatting rather than the spreadsheet approach. I don't know when this becomes easier, but it is something to keep in mind.
Bookmarks