Sub topic 7
Understanding and fixing #SPILL!
Prerequisites and scope
This chapter assumes you can enter formulas, use relative and absolute references, and know what an anchor cell and a spill range are from the previous chapters. You need Excel for Microsoft 365 or Excel 2021 or later. Older versions do not spill, so they never show this error.
By the end you should be able to read a #SPILL! error, find its cause, and choose the right fix.
What #SPILL! means
A dynamic array formula calculates first and then looks for room. The engine works out how many rows and columns the result needs. It then checks every cell in that rectangle. If any cell is unavailable, the formula writes nothing and shows #SPILL! in the anchor cell.
The formula itself is usually correct. The error describes the worksheet around it, not the formula's logic. Two facts follow from this:
- The result is all or nothing. Excel never fills part of the rectangle.
- The error clears by itself once the blocking condition goes away. You do not need to re-enter the formula.
Finding the cause
Select the cell that shows #SPILL!. A warning icon appears next to it. Click the icon, and the first line of the menu names the cause, such as "Spill range isn't blank". The menu also offers "Select Obstructing Cells" for the most common case. Excel then selects each cell that is in the way.
The menu text maps to the causes below.
| Message in the menu | Cause | Typical fix |
|---|---|---|
| Spill range isn't blank | A cell in the target rectangle holds a value, formula, or space | Clear or move the obstructing cells |
| Spill range has merged cells | A merged cell lies in the rectangle | Unmerge the cells |
| Spill range in table | The formula is inside an Excel table | Move the formula outside the table |
| Spill range is too big | The result extends past the edge of the worksheet | Reduce the result size |
| Unknown spill size or Extends beyond the edge | The size cannot be determined before calculation | Rewrite with a fixed size |
| Out of memory | The result is too large to hold | Reduce the result size |
| Spill into a data table or similar | A what-if data table is in the way | Move the formula |
Cause 1: obstructing cells
This is the most common cause. Suppose you enter this formula in E2.
=SEQUENCE(5)It needs E2:E6. If E4 contains anything, E2 shows #SPILL!.
Obstructions are often hard to see:
- A space character. A cell that looks empty can hold a single space or a formula that returns
"". Excel treats both as occupied. - White text or hidden rows. The value is there even if you cannot see it.
- A previous result. You pasted values over part of an old spill range, or a second formula spills into the same area.
- Another spill range. Two dynamic formulas can claim the same cells. The one that calculates second gets the error.
To fix it, choose "Select Obstructing Cells" from the warning menu, then press Delete. If the cells hold data you need, move the formula instead. Move it by cutting the anchor cell and pasting it where there is free space.
A formula that returns "" is a case worth remembering. If the spill region contains =IF(A1="","",A1) in some cell, that cell blocks the spill even though it displays nothing.
Cause 2: merged cells
A spill range cannot cover a merged cell. Merging is common in report layouts, so this error appears often when you add a formula to an existing sheet.
Unmerge the cells with Home, then Merge & Center. Then use "Center Across Selection" in Format Cells if you want the same look. Alternatively, move the formula to an area without merged cells.
Cause 3: formulas inside tables
Excel tables (created with Ctrl+T) do not support spilling. A formula that returns more than one value inside a table shows #SPILL!. Two options work:
- Put the formula outside the table and refer to table columns with structured references.
- Rewrite the formula so it returns one value per row, which is how tables expect formulas to behave.
For example, a formula outside the table can sort a table column. The table is named Sales here.
=SORT(Sales[Amount], 1, -1)The formula sits beside the table. It spills freely, and it resizes when rows are added to the table.
Cause 4: results too big or of unknown size
A worksheet has 1,048,576 rows and 16,384 columns. A result larger than that cannot fit. The usual accident is a whole-column reference in an array calculation.
=SEQUENCE(2000000)This asks for more rows than the worksheet has, so it returns #SPILL!. A more realistic version is a formula placed low on the sheet. If you enter a formula in row 1,048,000 that spills 1,000 rows, it runs off the bottom edge.
Whole-column references can also cause trouble. A formula like =A:A*2 has to evaluate over a million rows. It produces a million-row result, which is slow, and it fails if the anchor is not in row 1.
=A1:A1048576*2Entered in any cell outside row 1 and column A's rows, this spills past the bottom edge. Referencing a bounded range, or an exact spill range with #, avoids the problem.
Some functions return a size that Excel cannot predict before it calculates. Functions that depend on volatile, changing inputs can fall into this group. The usual example is a formula whose array size comes from RANDARRAY inside another function that determines dimensions. Excel reports an "unknown size" error because it needs the size before it can test the cells. The fix is to make the dimensions deterministic. Compute the count in one place with LET, or use a fixed number.
Cause 5: a spill that depends on itself
A formula can end up reading its own spill range. For example, a formula in E2 that includes E2# in its own arguments creates a circular reference. The result is a circular reference warning, not always #SPILL!. If the formula's size depends on cells that it fills, the size can never settle. Keep spill outputs separate from the inputs that determine their size.
A worked example
You have names in A2:A20 and amounts in C2:C20. You build a report in column E.
=SORT(UNIQUE(A2:A20))You enter this in E2 and see #SPILL!. The steps to diagnose it:
- Select E2 and open the warning menu. It says "Spill range isn't blank".
- Choose "Select Obstructing Cells". Excel highlights E9, which holds a stray note from an earlier draft.
- Press Delete, or move the note. The list now spills into E2:E12.
If you want to protect against future obstruction, leave the spill area empty and put notes in a column to the right of any area a result may grow into. A spill range can grow when the source data changes, so leave space below the anchor and not only enough space for the current result.
Growing results and later errors
A formula can work today and fail next month. Suppose =FILTER(A2:C20, C2:C20>100) spills 4 rows. Someone then types a total in the cell below the spill range. The data grows to 9 rows, and now the result runs into that total. #SPILL! appears even though nobody touched the formula.
To reduce this risk:
- Put the spill range at the bottom of its column, or in a column with nothing below it.
- Keep related spill ranges apart, or place them side by side with several blank columns between them.
- Put totals above the spill range, and use
SUM(E2#)to refer to the result.
=SUM(E2#)The # operator follows the current size of the spill range. The total does not need adjusting when the list grows.
Quick checks when the cause is unclear
If the warning menu does not make the cause obvious, work through these steps:
- Select the anchor cell. A blue border shows the area Excel tried to use, drawn as a dashed outline when the spill fails.
- Look for non-empty cells inside that outline. Use Ctrl+Shift+End or Go To Special, then Constants, to find stray values.
- Check for merged cells in the area. Select the area and look at whether Merge & Center is highlighted.
- Check whether the anchor is inside a table. A table has a Table Design tab when you select a cell in it.
- Reduce the formula to its core. Replace the argument that sets the size with a small number such as 3 and see whether the error disappears.
What does not cause #SPILL!
Some problems look similar but have other causes.
- #CALC! means the formula produced an empty array. The next chapters cover it. No spill is attempted, so the worksheet layout is not involved.
- #VALUE! or #REF! points to a problem inside the formula or its references.
- Showing only one value in an old workbook often means the formula is using implicit intersection, covered in a later chapter. No error is shown, but only one value appears.
Summary of fixes
- Select the anchor cell and read the warning menu first.
- Clear obstructing cells, including cells with spaces or
"". - Unmerge cells, and move formulas out of tables.
- Keep results within the worksheet's edge.
- Leave room for the result to grow.
Exercise
A formula =FILTER(A2:C20,C2:C20>100) in E2 worked last week and now shows #SPILL!. Nobody edited it. Name two likely causes and how you would confirm each.
Show answer
The result grew and now runs into a non-empty cell below it, such as a typed total or a stray note. Confirm this by clicking the warning icon and choosing "Select Obstructing Cells". Another cause is that someone merged cells or converted the area into a table near the spill range. Confirm it by selecting the dashed outline area and checking for merged cells or a Table Design tab. The fix is to clear or move the blocking cells, unmerge them, or move the formula to free space.
Exercise
A cell inside the spill area looks empty but still blocks the spill. What could it contain, and how can you find it?
Show answer
It can contain a space character or a formula that returns an empty string, such as =IF(A1="","",A1). Excel treats both as occupied. Use the warning icon's "Select Obstructing Cells" command, which selects them even though they look blank, and then clear them.