Running totals in 2D Dynamic array

vampsthevampyre

New Member
Joined
Apr 29, 2016
Messages
32
Office Version
  1. 365
Platform
  1. Windows
Evening All,

I'm looking to create a dynamic 2D array that generates a running total (L4-P13) for each of the possible numbers (F4-F8).

Any help would be appreciated

Regards
Ian

Book1
EFGHIJKLMNOPQ
2
3Possible NumbersIDNumbers12345
410000000
521110000
632211000
743311100
854411110
95511111
106212111
117412121
128312221
139122221
14
Sheet6
Cell Formulas
RangeFormula
L3:P3L3=TRANSPOSE(Table12[Possible Numbers])
H4:H13H4=ROW()-ROW(Table11[#Headers])-1
Dynamic array formulas.
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
How about
Excel Formula:
=DROP(REDUCE("",L3#,LAMBDA(x,y,HSTACK(x,SCAN(0,Table11[Numbers],LAMBDA(a,b,IF(b=y,a+1,a)))))),,1)
 
Upvote 0
Solution
You're welcome & thanks for the feedback.
 
Upvote 0
For demonstration purposes, it's also possible to SCAN by column without using REDUCE-HSTACK:

Excel Formula:
=LET(
    arr, EXPAND(Table12[Possible Numbers]=TOROW(Table11[Numbers]),,ROWS(Table11)+1),
    DROP(TRANSPOSE(SCAN(0,arr,LAMBDA(a,v,IFNA(a+v,0)))),-1)
)

Since SCAN works in row major order, start by flipping the array on its axis so the columns will be horizontal. Then, EXPAND the new array by one column, to be used as the reset point at the end of each row (when the [pad_with] argument is omitted, the new column will be filled with #N/A errors, which can be trapped with IFNA). Lastly, TRANSPOSE the results and DROP the additional row.
 
Upvote 0

Forum statistics

Threads
1,225,726
Messages
6,186,677
Members
453,368
Latest member
xxtanka

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