Hello Excel experts!
I'm a long time reader, first time poster. Please be gentleI'm running this in Windows on Excel 2007.
I'm looking to see if this is possible using Excel formulas, rather than a VBA solution. If this is too complicated for formulas, let me know.
I have some annual data, which does not start in A1. The data is created by some previous spreadsheet formulas on the worksheet, so I can't relocate it.
Year values in row 85 go back to 2000, counts in row 86 go back that far as well. Future years have blank entries. Here is an example of what it looks like:
N O P Q R S T U V W X Y Z 85 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 86 30 18 12 35 45 8 17
I also have some control cells, which are the core of the table generation:
M80 (target year): 2010
M81 (spread): 2
M82 (window): 4
The purpose is to create a DYNAMIC TABLE that is "window" years wide starting with the target year. The header row would be calendar years. This header row for this example would be
These could start anywhere. For this example, destination for the start of this range would be Q90 (i.e. Q90 :=2010).
2010 2011 2012 2013
The values to be placed in the dynamic table (starting at Q91) would be:
The cumulative sum from the start of the values up to the "target year +1", divided by the "spread". i.e. =SUM($G$86:Q86)/M81.
This same value repeated a second time (since spread is 2). i.e. =SUM($G$86:Q86)/M81.
The remaining years (Window - spread) contain the values under the year.
The end result I would want is
2010 2011 2012 2013 =SUM($G$86:Q86)/M81 =SUM($G$86:Q86)/M81 =R86 =S86 47.5 47.5 45 8
The dynamic table changes (i.e. grows or shrinks) based on the parameters (start year, window, spread).
I managed to manually insert an offset array function for the "non cumulative" years, but I get #N/A errors since my destination array is larger (except for the largest window sizes) than my results. I did this via the select range, press F2, enter formula, CTRL+SHIFT+ENTER.
Like I said at the start - this is complex and I could write some VBA code to handle it, but I'd like to try a formulaic approach first.
Thanks for listening! I look forward to your responses![]()
Bookmarks