Reverse Order of Two Dimensional Arrays Using Offset Function

Etoilebrilliant

New Member
Joined
Oct 10, 2017
Messages
5
First off, thank to everyone on this board. In fact the question I'm posing is a variation to a question that was successfully asked here and from which I learnt a lot.

Background: I've been using the following formula for aggregating the product of two arrays where the latter array needs to be presented in reverse order - needless to say it works perfectly

=SUMPRODUCT(OFFSET($C12,0,0,1,C$2),N(OFFSET(Vectors!C7,0,2-COLUMN(Vectors!$B7:B7),1,1)))

Now I want to take the formula to the next stage and use it to aggregate the product of multiple arrays

=SUMPRODUCT(A1,A2,A3:Va,Vb,Vc)

Or rewritten as:

=SUM(V1xVa, V2xVb, V3xVc)

The SUMPRODUCT function is excellent and can deal with multiple arrays natively. The problem arises when I wish to reverse the order of the second set of arrays.
The existing formula (see below) only seems to work with singular arrays

N(OFFSET(Vectors!C7,0,2-COLUMN(Vectors!$B7:B7),1,1)))

Any suggestions. At the moment, I'm inclined to write a user defined function but this seems clumsy. Bear in mind that the number of items of each array will change as per column - so creating a helper field with won't be a solution.

Thanks in Advance

1636230488643.png
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
There is too little useful information in a screen capture, among other things your formula refers to C$2 which appears to contain a text string, which subsequently is not valid to use as the offset range width.

For the sample to be useful it would need to be posted using XL2BB and include all of the data that the formula refers to, which included that on the vectors sheet.

See if this does what you want, will need to be array confirmed with Ctrl Shift Enter if not using office 365 (please update your Account Details to show which version you are using, remember to scroll down and save changed after selecting your version).
Excel Formula:
=SUMPRODUCT(OFFSET($C5,0,0,3,C$2),N(IF({1},OFFSET(Vectors!C10,0,2-COLUMN(Vectors!$B7:B7),3,1))))
 
Upvote 0
Apologies, you are correct to pull me to one side. Here I have uploaded the revised file in XL2BB.

Many thanks once again.

Volvo Care Depreciation Model Luke Sandpit.xlsx
ABCDEFGHIJKLMN
1Cash Flows (Portfolio Effect)1-Jan-221-Feb-221-Mar-221-Apr-221-May-221-Jun-221-Jul-221-Aug-221-Sep-221-Oct-221-Nov-221-Dec-221-Jan-23
2Month 0Month 1Month 2Month 3Month 4Month 5Month 6Month 7Month 8Month 9Month 10Month 11Month 12
3Vectors
4Asset Depreciation Curve
5Vehicle Depreciation A0.00%1.41%1.21%1.09%1.62%1.58%1.03%1.10%1.12%1.74%1.64%1.42%1.82%
6Vehicle Depreciation B0.00%1.11%1.23%1.62%1.60%1.94%1.77%1.62%1.73%1.55%1.78%1.15%1.88%
7Vehicle Depreciation C0.00%1.34%1.81%1.69%1.76%1.49%1.95%1.46%1.39%1.02%1.79%1.52%1.64%
8
9Asset Volumesby Cohort
10Vehicle Volumes A0.00621.38488.65349.40987.33350.29139.64720.7092.87218.51813.21533.74590.84
11Vehicle Volumes B0.00267.54586.22862.35339.24894.78292.02406.66318.97173.69773.44153.56471.26
12Vehicle Volumes C0.00494.09166.80719.19818.33878.92664.60727.71658.2420.40208.61615.02168.99
13
14Aggregate Depreciation for All Cohorts
15Vehicle Volumes A0.008.7414.3717.5633.5138.3636.7349.0848.6950.1466.1171.8282.67
16Vehicle Volumes B0.002.969.7921.1128.1842.6549.7059.4863.5868.7378.1279.4588.40
17Vehicle Volumes C0.006.6211.1921.0335.5049.0763.4572.2384.2383.1186.6689.8095.11
18This works . But I need to produce the formula 'row by row'. I wish to aggregate
19Formula for Rows 15 to 17 -----------------> =SUMPRODUCT(OFFSET($C10,0,0,1,C$2),N(OFFSET(C5,0,2-COLUMN($B5:B5),1,1)))
20
21Multiple Arrays (2nd Array not Reversed)0.0018.3334.4764.42100.26136.22155.82180.98196.69203.38
22This works - however, the depreciation curve is not reversed
23Formula for Row 21 -----------------> =SUMPRODUCT(OFFSET($C5:C7,0,0,3,C$2),OFFSET($C10:C12,0,0,3,C$2))
24
25Multiple Arrays (2nd Array Reversed)0.00#VALUE!
26This is where I need help - failed attempt
27Formula for Row 25 -----------------> SUMPRODUCT(OFFSET($C5:C7,0,0,3,C$2),N(OFFSET(Vectors!C10,0,2-COLUMN(Vectors!$B7:B7),3,1)))
Vectors
Cell Formulas
RangeFormula
C1:N1C1=EOMONTH(B1,0)+1
C2:N2C2=B2+1
C15:N17C15=SUMPRODUCT(OFFSET($C10,0,0,1,C$2), N(OFFSET(C5,0,2-COLUMN($B5:B5),1,1)))
C21:K21C21=SUMPRODUCT(OFFSET($C5:C7,0,0,3,C$2),OFFSET($C10:C12,0,0,3,C$2))
C25C25=SUMPRODUCT(OFFSET($C5:C7,0,0,3,C$2),N(OFFSET(Vectors!C10,0,2-COLUMN(Vectors!$B7:B7),3,1)))
Named Ranges
NameRefers ToCells
ArrayDepreciationCurveActual=Vectors!$B$6:$DR$6C16:N16
 
Upvote 0
I can see the problem now. If it was something that was a more common occurrence then I may well have noticed it without having to test it first, although I'm sure it has happened more often this is only the second time that I can recall seeing it.

If you try the formula that I suggested in post 2 you will see that it gives a result in the first column as being only a single column there is nothing to reverse at that point. As soon as the formula is expanded to the second column it creates an error. Although I have not seen anything definitive explaining the causes, I believe that it is the result of the arrays being produced containing more dimensions than the functions can cope with. Effectively you have Arrays x Rows x Columns. For the formula to return a valid result at least one of those must be singular, as soon as the smallest dimension contains more than 1 element it fails.

There may be as yet undiscovered ways to work around it with other functions but given how unlikely I think it will be that an accurate working formula can be found, I would suggest going with the alternative option of using a UDF for the task.
 
Upvote 0

Forum statistics

Threads
1,223,904
Messages
6,175,295
Members
452,631
Latest member
a_potato

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top