Fill a range with one formula, and fix #SPILL!
Formulas that spill8 min
Builds on Copy a formula down a column and Add it up with SUM.
A buyer at an office furniture importer in Rotterdam checks every order before it goes to the supplier. She used to fill a total formula down each line. Now she writes it once, at the top, and Excel fills the column.
How it works
In Microsoft 365 and Excel 2021 or later, a formula can return several values. Excel shows them in the empty cells below or beside it, and the formula is said to spill. Give it a range where one value would go and the calculation runs once per cell, so =B2:B9* multiplies eight quantities by their eight prices.
Picture water poured into the top cell, running into as many empty cells as the result needs. Only that first cell holds the formula; the others show its results. Because the formula is written once and never filled, a fixed input such as a rate in F1 needs no $.
D2# means everything D2 spills, however many cells that is, so other formulas can use the whole result. When a cell in the way isn't empty, Excel can't spill and shows #SPILL! in the first cell until you clear it.
Example
An order has quantities in B2:B9 and unit prices in C2:C9.
=B2:B9*C2:C9D2# refers to all of them. In D2, =B2:B9*C2:C9 returns €99.60.The first line, four desk lamps at €24.90, shows €99.60, and =SUM( adds up all eight lines to €1,468.25.
#SPILL!. Delete D6 and they come back. In D2, =B2:B9*C2:C9 returns #SPILL!.Common mistakes
- A note typed into the spill, as in D6 above, blocks all of it. Delete the entry and the totals come back.
- Filling the formula down puts a copy in D3, inside D2's spill, so D2 shows
#SPILL!. Write a spilling formula once, in its first cell. =B2:B9*multiplies every quantity by the first price only. Give both ranges, with the same number of rows.C2 =SUM(adds the cells that hold results today. A spill can change size, as FILTER's does in the next lesson, andD2:D9) =SUM(follows it.D2#)
In short
- A formula that returns several values spills into the empty cells around it, and only the first cell holds it.
D2#means everything D2 spills, so=SUM(keeps up as the spill changes size.D2#) #SPILL!means a cell in the way isn't empty.- Write it once: a fixed input needs no
$, since nothing gets filled.
Practice
4 exercises · free, no account needed