Dynamic Array referencing previous row

dreid1011

Well-known Member
Joined
Jun 4, 2015
Messages
3,614
Office Version
  1. 365
Platform
  1. Windows
Is it possible to reference the previous row in a dynamic array formula? Such as below, in column C, I can add this portion: "-MAX(0,C1)" in C2 to effectively reference the previous value in the next row's calculation.

Book1
ABCDE
1
210000-40000-40000
311000-29000-29000
426000-3000-3000
5700040004000
6290002900033000
7
850000
Sheet2
Cell Formulas
RangeFormula
E2:E6E2=BYROW(SCAN(0,B2:B6,LAMBDA(a,b,b+a)),LAMBDA(r,r-$B$8))
C2:C6C2=SUM($B$2:B2)-$B$8-MAX(0,C1)
Dynamic array formulas.
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
How about
Excel Formula:
=-SCAN(B8,B2:B6,LAMBDA(a,b,a-b-MIN(0,a)))
 
Upvote 1
You're welcome & thanks for the feedback.
 
Upvote 0
Okay, I am sorry, I thought I could figure this part out so I didn't mention it. But how about only showing 0 for the negative amounts? I have tried different combinations of MAX and MIN since you have the "-" preceding SCAN, but it's just skewing the LAMBDA results.

Book1
FG
1Desired
2-400000
3-290000
4-30000
540004000
62900029000
Sheet2
Cell Formulas
RangeFormula
F2:F6F2=-SCAN(B8,B2:B6,LAMBDA(a,b,a-b-MIN(0,a)))
Dynamic array formulas.
 
Upvote 0
How about
Excel Formula:
=MAP(-SCAN(B8,B2:B6,LAMBDA(a,b,a-b-MIN(0,a))),LAMBDA(m,MAX(0,m)))
 
Upvote 0
Solution

Forum statistics

Threads
1,223,941
Messages
6,175,537
Members
452,652
Latest member
eduedu

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