Sub topic 3
How a formula spills into neighboring cells
This chapter assumes you can enter formulas, use ranges such as B2:B6, and use basic functions such as SUM. It also assumes you have Excel for Microsoft 365 or Excel 2021 or later. Older versions do not spill.
One formula, many results
In older Excel, a formula returned one value to one cell. In dynamic array Excel, a formula can return an array, which is a block of values with rows and columns. When it does, Excel writes the values into the neighboring cells. This is called spilling. The cells that receive the values are the spill range.
You enter the formula the normal way, by pressing Enter. No special key combination is needed.
Your first spill
Type this in an empty cell, with the cells below it empty:
=SEQUENCE(5)SEQUENCE returns the numbers 1 to 5 as a column. Excel puts 1 in the cell you typed in and spills 2 to 5 into the four cells below it.
A second argument adds columns:
=SEQUENCE(3,4)This returns a grid of 3 rows and 4 columns holding 1 to 12. The numbers count across each row before moving to the next one.
Spilling from ordinary arithmetic
Spilling is not limited to special functions. Any formula whose result is an array will spill. Suppose B2:B6 holds quantities and C2:C6 holds prices:
=B2:B6*C2:C6Excel multiplies the two ranges row by row and returns five values. They spill down from the cell where you typed the formula. In older Excel you would have written one formula and filled it down five rows.
Two ranges of the same size pair up item by item. If the sizes differ, Excel fills the missing positions with #N/A, so keep the ranges aligned.
What happens when you recalculate
The spill range is not fixed. Excel recalculates the formula and resizes the range to fit the new result. If you change SEQUENCE(5) to SEQUENCE(8), the spill grows to eight cells. If the source data shrinks, the spill shrinks too.
The diagram below shows the sequence.
Working with a spill range
Only the first cell holds the formula. Click any other cell in the spill range and the formula bar shows the same formula in gray. You cannot edit it there. Edit the first cell instead, which is called the anchor.
- Selecting any cell in the range draws a thin blue border around the whole spill range.
- Deleting the anchor's formula clears every spilled value.
- Typing over a spilled cell is not allowed while the spill is active. That cell is occupied by the result.
The spilled cells cannot be edited on their own, so the layout stays consistent with the formula. The next chapter covers the anchor and the range in more detail.
When something is in the way
A spill needs every target cell to be empty. If a cell in the path holds a value, a formula, or even a space character, Excel cannot write the array. The anchor then shows #SPILL!. Clear the blocking cell and the spill appears right away. A later chapter covers the other causes.
Check your understanding
Exercise
You enter =SEQUENCE(3,4) in D2, and D2:G4 are empty. Which cells does the result fill, which cell holds the formula, and what values are in the second row?
Show answer
The result fills D2:G4, a 3-by-4 block. Only D2, the anchor, holds the formula. The second row, D3:G3, holds 5, 6, 7 and 8, because the numbers count across each row.
Exercise
Cell E4 is inside a working spill range. You want to change the formula. Where do you edit it, and why?
Show answer
Edit it in the anchor cell, the first cell of the range. The other cells only display results and cannot be edited on their own.