The #SPILL! error appears when a dynamic array formula has more results than it can place. The formula needs empty cells below or beside it, and something is in the way. Clearing those cells, or moving the formula to open space, usually fixes it.
How spilling works
Newer versions of Excel have dynamic array formulas. Functions such as FILTER, SORT, UNIQUE and SEQUENCE can return several values at once. Excel places those values in the cells around the formula, and this is called spilling. Only the top-left cell contains the formula. The other cells show results. FILTER is a common example, and how to use filter function in excel covers its basics.
What blocks a spill
- Existing content. Any value, text or formula in the spill range blocks it. A formula that returns an empty text string also counts as content.
- Merged cells. Merged cells inside the spill range can block the results.
- The edge of the worksheet. If the results would run past the last row or column, the formula can’t spill.
How to fix it
- Click the formula cell and look at the cells below and to the right of it.
- Clear what’s in the way. Select those cells and press Delete. Check first that you’re not removing data you need.
- Unmerge any merged cells in the spill range.
- If the results still don’t fit, move the formula to a clear area of the sheet.
- Narrow the criteria so the formula returns fewer results.
Don’t type values into the spill range. The formula can only fill cells that are empty.
Refer to a spill range
Put a # after a cell reference to refer to the whole spill range. For example, =SUM(A2#) adds up everything the formula in A2 currently spills. If the number of results grows or shrinks, the reference follows the change. How to reference spill range in excel explains the pattern in more detail.
Google Sheets
Google Sheets doesn’t use #SPILL!. A similar block shows up as #REF! with a message such as “Array result was not expanded because it would overwrite data in…” The fix is the same: clear the cells named in the message so the array result has room to fill.