Need to refer to previous rows and columns in spill range

Joe_S

New Member
Joined
Feb 22, 2012
Messages
6
Below is my spill range formula. Variable "result" in the LET is populating the cells. I am struggling to define variables prevAmtRows and PrevAmtColumns which are assigned a value of 999.

What l need PrevAmtRows to do is to calculate the values returned by result in the previous rows of the column. Row 1 is always zero. For example, if rows 1,2, and 3 of column 1 have a value of 100 returned by result, row 4 should return 300 for variable prevAmtRows. PrevAmtColumns is the same concept in that it should calculate the sum of result on the row up to the previous column with column 1 always being zero.

I've read about recursive lambdas and DROP and SCAN function, but still cannot figure it out. This is my final step to complete my task.

Please note that the formula below is in a spill range.


=MAKEARRAY(EndYear-StartYear+1, EndYear-StartYear+1,
LAMBDA(r,c,

LET(
cyLoss, INDEX(MyLosses,r),
cyIncome, INDEX(myIncome,c),
PrevAmtRows, 999
PrevAmtColumns, 999

result, MIN(cyLoss-PrevAmtRows, MAX(0,cyIncome)-PrevAmtColumns),
result)
)
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
It would be helpful if you could post sample data and you're expected result.
 
Upvote 0

Forum statistics

Threads
1,216,790
Messages
6,132,709
Members
449,753
Latest member
swastikExcel

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