Sub topic 13
Fixing #SPILL!: blocked dynamic array results
This chapter assumes you can enter formulas, use cell references and ranges, and know that Excel 365 and Excel 2021 or later support dynamic arrays. The chapter covers the causes of #SPILL! and how to clear each one.
What a spill is
A dynamic array formula can return many values from one formula. The cell holding the formula is the anchor. The results fill the cells below and to the right of it. This filled area is the spill range. Excel draws a thin blue border around it when you select any cell inside.
#SPILL! appears when Excel cannot fill the spill range. The formula itself is usually correct. Something is in the way, or Excel cannot work out how big the result is.
=SORT(A2:A10)If this formula is in D2, the sorted values need D2:D10 to be empty apart from the formula itself.
Finding the cause
Select the cell with #SPILL!. A yellow warning icon appears beside it. Click the icon, and the first line of the menu names the cause. Choose Select Obstructing Cells to jump to whatever is blocking the range.
Common causes and fixes
| Cause | Fix |
|---|---|
| Cells in the spill range contain data | Delete or move the data, or move the formula |
| A cell looks empty but holds a space or an empty-text formula | Select the obstructing cells and clear them |
| The spill range includes merged cells | Unmerge the cells, or move the formula |
| The formula is inside an Excel Table | Move it outside the table, because tables do not allow spilling |
| The spill range runs past the edge of the worksheet | Reduce the size of the result or move the formula up or left |
| Excel cannot determine the size of the result | Rewrite the formula so its size is fixed |
Hidden obstructions
A cell that looks blank can still block a spill. A single space, a formula returning "", or a cell with only formatting that holds a value will all count. Use Select Obstructing Cells instead of looking for the problem by eye.
Tables and merged cells
Excel Tables and merged cells cannot hold a spill. For a table, copy the formula to a range outside the table. For merged cells, use Merge & Center to unmerge them.
Unknown size
Functions such as RANDARRAY and SEQUENCE can return an array whose size depends on a volatile or changing value. If Excel cannot calculate the size, you get #SPILL!. Fix it by using fixed arguments.
=SEQUENCE(5,1)Worked example
Cell E2 contains the following formula.
=UNIQUE(A2:A20)It returns #SPILL!. The unique values need E2:E8, but E5 contains a note typed by a colleague.
- Select E2 and click the warning icon.
- Read the first menu line, which says the spill range isn't blank.
- Choose Select Obstructing Cells. Excel selects E5.
- Move the note to another column, or press Delete.
The formula spills at once. No edit to the formula was needed.
Referring to a spill range
To refer to the whole spill range from another formula, add # after the anchor cell. For example, =SUM(E2#) adds every value that UNIQUE returned. If the spill grows or shrinks, the reference follows it.
=SUM(E2#)If E2 shows #SPILL!, the formula =SUM(E2#) also returns an error. Fix the anchor first.
Preventing #SPILL!
- Leave space below and to the right of a dynamic array formula.
- Keep dynamic array formulas outside Excel Tables.
- Avoid merged cells near result areas.
- Do not wrap #SPILL! in
IFERROR. The error means the formula cannot show its results, so a hidden error leaves the output missing with no signal.
Exercise
A formula =FILTER(A2:C50,C2:C50>100) in F2 returns #SPILL!. The results need about 12 rows and 3 columns. Cell G5 looks empty. What is the fastest way to find the cause, and what might G5 contain?
Show answer
Click the warning icon beside F2 and choose Select Obstructing Cells. Excel selects whatever blocks the range. G5 may hold a space, or a formula that returns an empty string, so it looks blank but still counts as content. Clear those cells and the formula spills.