Forum Discussion
Return of the Corkscrew with Spilled Arrays
- Oct 23, 2024
James_Buist Just for good measure, MMULT can also get the job done with minimal effort.
Closing Balance (cell G22):
=LET( data, HSTACK(F22:F24,G12:M14+G17:M19), cId, SEQUENCE(,COLUMNS(data)), arr, MMULT(--data,--(DROP(cId,,1)>=TOCOL(cId))), VSTACK(arr,BYCOL(arr,SUM)) )Cheers!
Hi James
I am not sure why this reappeared in my feed, especially since it is marked as a solved problem!
However, this time I have attached a possible solution using a complicated form of the SCAN function that works with array of array problems. My intention is that SCANHλ helper function should be reasonably easy to incorporate into a model.
The core element of the financial models I have seen, is the Lambda function that addresses a single period within the model and, knowing the opening balances, calculates the closing balances. Being a single period, model circular references are avoidable. This function may be used within SCAN (or a generalisation of SCAN) to calculate the closing balances for the entire model. Closing balances are brought forward to form opening balances, here using B∕Fwdλ. Once they are known the entire model can be calculated and presented as a single array calculation.
The catch with going so far into array manipulation is that the flow of the calculation is best read from the formulas rather than by examining cells on the worksheet. That will ruffle many feathers.
- PeterBartholomew1Dec 16, 2025Silver Contributor
Problems with posting workbooks!
Thanks for the help!
The platform seams to have got a lot worse recently! It is easy to miss prior posts because they are hidden and posting attachments is an utter mess!
- djclementsDec 18, 2025Silver Contributor
You're welcome, Peter!
You may also want to change your profile settings, if you haven't already done so, to disable the default "threaded" conversation view. Under My Settings > Preferences > Replies and Comments, change Display format to Linear and Default sort order to Newest to Oldest.
Sergei was kind enough to point this out to me in another thread.
- djclementsDec 16, 2025Silver Contributor
Hi Peter,
Try editing your reply and reattach the workbook (click the ellipsis menu icon next to the response you want to edit). This has worked for me so far...
Kind regards.