Forum Discussion
Excel array question - spill VOWD based on forecast month
Hi,
Can I have your help on a spilled question?
I have the following table with information.
| Fore Month | Jan-26 | Feb-26 | Mar-26 | Apr-26 | May-26 | Jun-26 | Jul-26 | Aug-26 | Sep-26 | Oct-26 | Nov-26 | Dec-26 | VOWD |
| 2 | - | - | - | 3,983 | 15,203 | 11,779 | 2,083 | - | 1,742,162 | 1,696,156 | 116,267 | 1,162,366 | - |
| 2 | - | - | 100,000 | 200,000 | - | - | 500,000 | 650,000 | 300,000 | - | 466,000 | - | - |
| 3 | - | - | - | 3,983 | 15,203 | 11,779 | 2,083 | 10,000 | 1,742,162 | 1,696,156 | 116,267 | 1,152,366 | - |
| 3 | - | - | 100,000 | 200,000 | - | 250,000 | 250,000 | 650,000 | - | 400,000 | 450,000 | - | 100,000 |
| 4 | - | - | - | 2,000 | 15,203 | 11,779 | 2,083 | 10,000 | 1,742,162 | 1,696,156 | 116,267 | 152,366 | 2,000 |
| 4 | - | - | 100,000 | 200,000 | - | 250,000 | 250,000 | 650,000 | - | 400,000 | 350,000 | - | 300,000 |
I would like to have a spilled array formula in VOWD column and the expected result is right there now. The logic is to grab the first 2 columns and sum up the amounts for the first two rows of data, and grab first three columns and sum up for the third and forth rows of data and etc.
Thanks,
Anna
4 Replies
- SnowMan55Bronze Contributor
There is no need to use a LAMBDA function to accomplish this. The OFFSET function will suffice. See this workbook: 2026-02-22 Anna summing variable ranges.xlsx
- Olufemi7Iron Contributor
Hello caltana,
Use this dynamic spill formula for VOWD: =MAP(A2:A7, B2:M7, LAMBDA(fm, row, SUM(IFERROR(--TAKE(row, fm), 0)))) – MAP processes each row, fm is the Fore Month, row is the monthly data, TAKE(row, fm) picks the first fm months, IFERROR(--…,0) converts any "-" to 0, and SUM adds them. It spills automatically, sums the first N months per Fore Month, and needs no helper columns. - Patrick2788Silver Contributor
My approach is to use a mesh grid of column coordinates and pick out what you need. MGridλ is a generalized function that returns row or column numbers. Here it's returning column numbers.
=LET( j, MGridλ(MonthlyData, 1), mdata, IF(j <= ForeMonth, MonthlyData, 0), totals, BYROW(mdata, SUM), totals )This is what it looks like step-by-step:
- NikolinoDEPlatinum Contributor
=MAKEARRAY(ROWS(A2:A7), 1, LAMBDA(r,c,
LET(
fore_month, INDEX(A2:A7, r),
SUMPRODUCT(N(COLUMN(B1:M1)<=COLUMN(B1)+fore_month-1), INDEX(B2:M7, r, 0)))))
Based on your description, the logic is to sum the values from the first N months (where N equals the "Fore Month" value) for each pair of rows.