Fix Excel BYROW Rolling Sum Returning Shifted Values
Question details
The user is experiencing an issue where a Microsoft 365 Excel formula calculating a seven-row rolling sum returns shifted values instead of the expected totals when using BYROW.
- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- Calculating a seven-row rolling sum using dynamic array functions including BYROW, VSTACK, TAKE, DROP, and SUM.
- Observed behavior
- The formula produces shifted values instead of the correct rolling totals, which appears to be a known behavior with the BYROW and SEQUENCE construct in Excel.
Ensure your spreadsheet software supports dynamic array functions like LET, BYROW, and MAP. Double-check your referenced arrays to confirm no empty cells are inadvertently causing the offset.
Use the Implicit-Intersection Operator (@) in the BYROW Formula
Resolve the shifted value behavior by adding the implicit-intersection operator before the BYROW variable within the DROP function.
This is a known behavior in Excel when combining BYROW and SEQUENCE constructs. Adding the @ operator forces Excel to evaluate the exact row context, preventing the array from shifting incorrectly.
Open your formula and find the DROP function nested within the LAMBDA calculation of your BYROW setup.
Insert the @ symbol just before your BYROW variable. For example, change 'x-1' to '@x-1' inside the DROP function.
Enter the updated formula into your cell: =LET(WinHalf,3,Diff,SEQUENCE(10),Margin,SEQUENCE(WinHalf,,0,0),ExArr,VSTACK(Margin,Diff,Margin),Calc,BYROW(SEQUENCE(ROWS(Diff)),LAMBDA(x,SUM(TAKE(DROP(ExArr,@x-1),2*WinHalf+1)))),Calc).
Replace BYROW with the MAP Function
An alternative workaround is substituting BYROW with MAP to avoid the specific calculation shifts associated with BYROW arrays.
Calculate Complex Array Formulas Seamlessly with WPS Spreadsheet
WPS Office Spreadsheet provides robust support for advanced functions, arrays, and complex calculations. Easily manage your rolling sums and dynamic array formulas within a fast and user-friendly interface.
- 1. Open WPS Spreadsheet: Launch WPS Office and open a new or existing spreadsheet document.
- 2. Enter your data: Input your sequence or array data into the appropriate columns and cells.
- 3. Apply dynamic array formulas: Click on the formula bar and input your dynamic array formula, utilizing supported functions like LET, VSTACK, and MAP.
- 4. Press Enter to calculate: Hit Enter to execute the formula. The rolling sum results will automatically spill into the adjacent cells accurately.

Frequently Asked Questions
Why does BYROW sometimes return shifted values in Excel?
This is a known behavior when combining BYROW with functions like SEQUENCE and DROP inside a LAMBDA. Excel can misinterpret the array context, leading to offset calculations unless explicit row context is provided via the implicit-intersection operator.
What does the @ symbol do in an Excel formula?
The @ symbol is the implicit-intersection operator. It forces a formula that could potentially return an array to return a single value corresponding to the current row or column context, preventing unintended array spilling or shifting.
Can I use MAP instead of BYROW for rolling sums?
Yes, MAP is an excellent alternative. While BYROW applies a LAMBDA to each row of an array, MAP applies it to each individual element. This subtle difference often resolves unexpected shifting behaviors in complex dynamic arrays.




