September 20th, 2011, 12:17 pm
Hi Kimosabe, I have not tried xllarray yet--but I am interested in any new and interesting and useful things. I didn't start with xllarray for something new as yet, for a couple reasons. One is that I have zero experience with C/C++ (but I do have a little C#). Also, I wasn't sure if the raw array math addins would address my goal of simplifying cell formulas. To give you more background, a typical formula that I am trying to replace would take a start date and an end date as user inputs, for arguments, then it would look in a table with contract months, days per month, monthly prices, and monthly discount factors, to compute a weighted average. The current formula is: SumProduct(prices, days, discount factors) / SumProduct(days, discount factors). Each of the SumProduct arguments is an array, which is identified by using Match on the start date, and a hand-figured datediff in months, with these two as arguments to the Offset Function (using both the row offset and range resize functions that are within Offset). So in summary, we have 5 sumProducts, 5 Matches, 5 Offsets, 10 Month calls and 10 Year calls, for a formula 4 and 1/2 lines long. Would not xllarray only replace the SumProduct function? Leaving most of the lengthy formula work for identifying the vectors? What I've written in VBA takes prices, days, dfs, dates as a single range argument. I use Match once on the date, and VBA Resize 3 times, to pull column arrays out of the table/Range. I guess a point I'm getting at here is that in some places I need to make a table where I know how it is going to go, month by month from this month. Other places I need to compute an arbitrarily sized weighted average from user inputs.