I have a predefined list of x labels, e.g. months of the year. I want to dynamically exclude some of these from my excel plot, e.g. if some of the y values are blank, zero or errors.
Things I've tried:
- If I use an (if data is bad, then change xlabel to blank or NA()) process, excel still leaves a space for the blank or #N/A x label - see image. This is the second most upvoted answer to Creating a chart in Excel that ignores #N/A or blank cells, but doesn't quite do what I'm after... Unfortunately, there is no option for 'No Gaps' in the Hidden and Empty Cell Settings.
- If I filter out rows where the Y values meet the reject condition, I get the chart I want, but the filter doesn't update automatically when the Y values get changed by a calculation elsewhere, ie its not dynamic. Pivot charts are the same.
- I can't get formulaic named ranges (Excel charts - setting series end dynamically) to do what I want - the formula will return something like 'Jan, FALSE, Mar, Apr' rather than 'Jan, Mar, Apr', and we end up with the same problem as in the picture above.
Non-VBA solutions preferred = )