July 7, 2016
In the attached file, I have a report that displays sparklines in column D, and graphs in columns W-AE off to the right. The sparklines reference columns AJ-AU. Columns AN-AU have zeros in them. They'll be filled in as the year progresses. Similarly, the graphs reference the columns for Jul-Oct 2019. If I reference the dates to also include Nov 2019-June 2020, the graph series will be short; most of the graph will be blank (using na() for zeros).
I would like to have both sparklines and graphs display only the dates for which I have actuals. I don't see how to do this without a lot of manual adjustments, and I've got 75 of these to generate every month.
What are some options?
July 16, 2010
You need to set up dynamic named ranges for the chart source data. For the Sparklines, you can use a relative dynamic named range. Note: the chart source data references require the dynamic named ranges to be fully qualified i.e. with the sheet name then the dynamic named range e.g.:
July 7, 2016
I can see that using dynamic ranges would be useful here. As you add data to the range, the range changes automatically to pick it up. But what if my graph ranges are already set up for the whole year? With sparklines, the dynamic ranges work if the next column (in my example attached, Nov-19) is blank. Nov-19 could have "", or #NA, but it will never be blank—unless I manually add data for Nov-19 and fill in the vacant column. Sparklines interpret any of these as zero and will display zeroes for the remaining months, leaving extra space in the sparkline where I don't want it.
There's the same problem with graphs (where the month is the x-axis), but I found a workaround: If the month has no actuals yet, then the date reference could use an =NA() in the formula to produce #NA as the result. The graph will not show Nov-19 if there's no data yet for that month, even if the series range references the whole year.
Each month, I'll import the month's actuals into the file through Power Query, where formulas will then pick it up. Since I'm not adding data manually to the tables, the sparkline range has to be predefined as the whole year, but that leaves extra space in the sparkline cell. I could create sparkline-like graphs the size of the cell and then align them in the cell, but that's a pain.
What do you recommend?
July 16, 2010
I'd just have a drop down somewhere in the workbook that allows you to choose the month you want the charts to display up to. You can reference this drop down value in the dynamic named range formula i.e. use INDEX & MATCH to find the column that contains the month selected in the drop down instead of say COUNT/COUNTA to find the last cell in the range.
June 25, 2016