Excel Formulas for Adding Dynamic Arrays with Spill Ranges

📅 May 24, 2026 📝 Sarah Miller

Managing dynamic spill ranges in Excel often leads to frustrating calculations and formula errors when data dimensions shift unexpectedly. This analytical challenge frequently arises when consolidating standard funding sources, such as corporate capital, venture investments, and public grants, across disparate department ledgers. Fortunately, leveraging dynamic arrays grants financial modelers instantaneous, automated scalability. As a strict stipulation, however, the source arrays must maintain matching dimensions to prevent spill conflicts. Relying on the spill ref operator-like =A2# + B2#-is the exact thing to ensure calculations expand automatically. Below, we outline the step-by-step formulas and array behaviors to master this process.

Excel Formulas for Adding Dynamic Arrays with Spill Ranges

Excel's modern calculation engine, introduced with dynamic arrays, has completely changed how spreadsheets are designed. Gone are the days of manually dragging formulas down columns or writing complex CTRL + SHIFT + ENTER (CSE) array formulas. Today, if a formula returns multiple values, Excel automatically "spills" those values into adjacent cells. This dynamic output area is known as a Spill Range, and it is referenced using the spill operator (the hash symbol, #).

While dynamic arrays make retrieving and filtering data effortless, performing math operations across multiple dynamic arrays-such as adding them together-requires an understanding of how Excel aligns array dimensions. Whether you are adding two identical spill ranges, summing ranges of different sizes, or calculating row-by-row totals dynamically, this guide will walk you through the formulas and functions needed to master dynamic array addition.

The Basics: Adding Equal-Sized Spill Ranges

The simplest scenario occurs when you have two dynamic arrays of identical dimensions (same number of rows and columns) and you want to perform element-wise addition. In this case, Excel pairs the matching cells in each array and outputs a new spill range containing the sums.

To reference a dynamic array, point your formula to the top-left cell of the spill range and append the hash symbol (#). For example, if your first dynamic array starts in cell A2 and your second starts in cell D2, you can add them together using this straightforward formula:

=A2# + D2#

Example Scenario

Suppose you have generated two lists of numbers using the SEQUENCE function:

  • In cell A2: =SEQUENCE(5, 1, 10, 10) (Spills 10, 20, 30, 40, 50 down column A)
  • In cell D2: =SEQUENCE(5, 1, 5, 5) (Spills 5, 10, 15, 20, 25 down column D)

If you enter =A2# + D2# in cell G2, Excel matches the rows positionally and returns a new dynamic array:

Row Index A2# (Array 1) D2# (Array 2) G2# (Result: A2# + D2#)
1 10 5 15
2 20 10 30
3 30 15 45
4 40 20 60
5 50 25 75

The Challenge of Mismatched Dynamic Arrays

What happens if your dynamic arrays are not the same size? For instance, what if A2# contains 5 rows, but D2# only contains 3 rows? If you try to add them directly using =A2# + D2#, Excel will calculate the sum for the first three rows correctly, but it will return #N/A errors for the fourth and fifth rows.

This happens because Excel performs element-by-element calculations based on corresponding index positions. When one array runs out of elements, Excel has nothing to pair with the remaining values of the larger array, resulting in missing data errors.

Solving Mismatches with the EXPAND Function

To safely add dynamic arrays of differing dimensions without producing #N/A errors, you can use the EXPAND function. EXPAND allows you to resize an array to a target row and column count, and specify a padding value (like 0) for the newly created cells.

By nesting EXPAND inside the LET function, we can dynamically calculate the maximum dimensions of both arrays, pad the smaller array with zeros, and then safely add them together. Here is the ultimate formula to add two mismatched dynamic arrays:

=LET(
    arr1, A2#,
    arr2, D2#,
    max_rows, MAX(ROWS(arr1), ROWS(arr2)),
    max_cols, MAX(COLUMNS(arr1), COLUMNS(arr2)),
    padded1, EXPAND(arr1, max_rows, max_cols, 0),
    padded2, EXPAND(arr2, max_rows, max_cols, 0),
    padded1 + padded2
)

How This Formula Works

  1. LET: Declares variable names for our arrays and dimensions, keeping the formula clean, readable, and highly performant.
  2. max_rows / max_cols: Uses ROWS and COLUMNS to check the sizes of both inputs, determining the maximum height and width required to fit both datasets.
  3. EXPAND: Pads both arr1 and arr2 to match the calculated max_rows and max_cols. Any empty slot generated by resizing is padded with a 0.
  4. Addition: Since both padded arrays are now perfectly identical in size, the final step safely adds them together element-by-element without any #N/A complications.

Row-by-Row Dynamic Totals using BYROW and HSTACK

Sometimes, your goal isn't to create another matching grid of element-wise additions, but rather to calculate horizontal totals for multiple spill ranges. For example, if you have two column-based dynamic arrays (e.g., Q1 Sales and Q2 Sales), you might want to create a third column showing the sum of each row.

You can achieve this elegantly using the BYROW helper function combined with HSTACK (Horizontal Stack). The formula looks like this:

=BYROW(HSTACK(A2#, D2#), LAMBDA(row, SUM(row)))

Breaking Down the Logic

  • HSTACK(A2#, D2#): Glues the two dynamic arrays side-by-side into a single, multi-column temporary array.
  • BYROW: Tells Excel to look at this combined array and process it row-by-row.
  • LAMBDA(row, SUM(row)): For each row in the stacked array, Excel temporarily assigns that row's cells to the variable row, passes them to the SUM function, and returns the combined row total. This spills down matching the exact height of your source arrays.

Aggregating an Entire Spill Range

It is important to distinguish between element-wise addition (adding corresponding cells) and total aggregation. If you want to sum up every single value contained inside a dynamic array to produce one single number, you simply pass the spill reference to the standard SUM function:

=SUM(A2#)

Similarly, you can sum multiple dynamic arrays together into a single scalar value by separating them with commas:

=SUM(A2#, D2#)

This ignores the shapes and sizes of the dynamic arrays entirely, reading all underlying numeric values across both spill ranges and providing a single, consolidated total.

Common Pitfalls and How to Avoid Them

When working with dynamic array math, you are likely to run into a few common Excel errors. Here is how to diagnose and fix them quickly:

1. The #SPILL! Error

A #SPILL! error occurs when there is physical data (text, numbers, or even invisible formatting/spaces) blocking the path of the expanding results. To fix this, click on the cell containing the error; Excel will highlight the border of the intended spill range with a dashed line. Clear any existing data out of that highlighted block, and the formula will instantly evaluate and spill.

2. The #VALUE! Error

If your spill range contains text headers or non-numeric characters, trying to perform direct addition (e.g., A2# + D2#) will result in a #VALUE! error. You can bypass text headers by starting your spill ranges a row lower, or write your addition formulas using functions that ignore text, such as wrapping your mathematical operations in SUM helpers or utilizing MAP with IFERROR to handle non-numeric data.

Conclusion

Adding dynamic arrays together is an incredibly efficient way to build responsive dashboards, financial models, and automated reporting systems. For equal-sized ranges, a simple + operator with spill references (#) is all it takes. When dealing with mismatched datasets, leveraging the power of modern functions like LET, EXPAND, and helper functions like BYROW ensures your formulas remain bulletproof, scalable, and error-free.

Disclaimer:
The documents and templates provided on this page are for informational and illustrative purposes only. They do not constitute professional, legal, or financial advice, and should not be relied upon as such. Because individual circumstances and regulatory requirements vary, these materials may not be suitable for your specific needs. We recommend consulting with a qualified professional before adapting or using any of these examples for official or commercial purposes.