I have a dynamic line chart. The user can choose to display the past 7 days, past 30 days, past 90 days, or past 365 days. If 7 days are selected, I calculate and display (in an adjacent cell) the +7 day forecast. If 30 days are shown, I calculate and display the +30 day forecast, etc. I also calculate the average for each line, and display in another adjacent cell.
I'd also like to display these points on the chart. If I chart them as individual series, they all appear on the left-hand y-axis, since there's only one data point to plot. This is fine for the average, but I'd prefer to move the forecast to the right-hand side of the chart, since that is the direction of the 'future'. I'm sure I could populate a column of "zero's" or "NA()"'s for each series and insert the forecast in the appropriate cell (7th, 30th, 90th, or 365th) and plot the result, but that seems like an awful lot of wasted spreadsheet space. Is there a way to use a named array in the SERIES function to dynamically create this data series? I feel I'm close to the solution, but after a few days I've hit a brick wall.
ZoomVal2 is the number of days on the x-axis (7, 30, 90, or 365). ForecastCell is the value of the Forecast. The following function returns the data I want plotted (6 zero's and the forecast, 29 zero's and the forecast, etc.) seperated by commas. I just can't figure out how to get the SERIES plotted.
=REPT("0,",ZoomVal2-1)&ForecastCell
returns "0,0,0,0,0,0,81" when ZoomVal2 is 7 and Forecast is 81, and works correctly when the other 3 options are selected.
I've purchased John Walkenbach's "Excel Charts", Charles Kyd's e-Book, and search other forums, with no luck.
Please forgive the lengthy post, and thanks in advance for any help offered. I'm new to arrays, so please use little words
Jeff
Last edited by VBA Noob; 11-19-2008 at 04:34 PM.
My first idea is that ZoomVal2 does not have fixed cell notation e.g. $A$4. Therefore ZoomVal2 references to different ranges for each cell in the worksheet and also for the cell where you use =REPT("0,",ZoomVal2-1)&ForecastCell.
If this was done correctly then an example workbook would be nice.
Looking for great solutions but hate waiting?
Seach this Forum through Google
www.Google.com (e.g. +multiple +IF site:excelforum.com/excel-general/ )
www.Google.com (e.g. +fill +combobox site:excelforum.com/excel-programming/ )
Ave,
Ricardo
ZoomVal2 is annotated correctly. I have a function named RedForecast that contains the results of the "=rept(..." function. When displayed in a worksheet cell, RedForecast properly displays "0,0,0,0,0,0,81", or "0,0,0,0,0...(total of 29 zeros)...,0,81" or ""0,0,0,0,0...(total of 89 zeros)...,0,81", etc. (minus the quotes, of course, and the actual forecast number is different for each range). What I can't figure out, is how to incorporate this into a SERIES function.
=SERIES(,,RedForecast,14)
...gives me an error to the effect that I "must have at least one data point to plot", or "A formula in this worksheet contains one or more invalid references".
I wonder if somehow RedForecast is being interpreted as a text string instead of numeric? Maybe it needs to be interpreted as an array??
The Cliff Notes version of my question is, "How do you plot a series of numbers on a graph, all zero's but the last one, without having the range stored in cells in a spreadsheet?"
Tushar Mehta kindly pointed me to this link, but I couldn't figure out how to convert his straight line to what I need...
http://www.tushar-mehta.com/excel/ch...nes/index.html
Thanks again for your effort.
Jeff
Just for the SERIES. normally this looks like:
=SERIES(,,Book1!RedForecast,14) or
=SERIES(,,Sheet1!RedForecast,14)
For the rest i would be very helpfull if you upload your data (workbook) so we can have a go with it.
Looking for great solutions but hate waiting?
Seach this Forum through Google
www.Google.com (e.g. +multiple +IF site:excelforum.com/excel-general/ )
www.Google.com (e.g. +fill +combobox site:excelforum.com/excel-programming/ )
Ave,
Ricardo
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks