Excel errors

#SPILL! error in Excel: causes and how to fix it

Fix #SPILL! in Excel 365: blocked spill range, merged cells, formulas in tables, full-column references, volatile sizes, out of memory. Every cause with a fix.

#SPILL! means "my results have nowhere to go". In Microsoft 365 and Excel 2021 and later, one formula can return many values that spill into the cells below and to the right, the dynamic array behaviour of FILTER, SORT, UNIQUE, SEQUENCE and any formula that works on a whole range. Excel only spills into cells that are completely empty and in a place where spilling is allowed. If anything blocks the way, the formula shows #SPILL! in its first cell instead of a partial result. The formula itself is usually correct; the problem is the space around it. This page shows every reason Excel gives for a #SPILL! and how to fix each one. The concepts are explained in Dynamic arrays: spill, FILTER, SORT, UNIQUE, SEQUENCE and #.

What #SPILL! means

When you select a #SPILL! cell, Excel draws a dashed border around the area the result wants to occupy, and a small warning icon next to the cell tells you the reason: Spill range isn't blank, Spill range has merged cell, Spill range in table, Spill range is unknown, Spill range is too big or Out of memory. Read that message first: each reason has a different fix, covered below.

Cause 1: the spill range isn't blank

The most common case. A list sorted with SORT needs four cells, and one of them already contains something. A single space, a formula returning "" or text formatted in white counts as "something" too.

C2fx=SORT(A2:A5)
ABC
1NameSorted
2Dana#SPILL!
3Ana
4Chennote
5Ben

C4 contains the word "note", which blocks the four-cell result.

Result: #SPILL!

C2fx=SORT(A2:A5)
ABC
1NameSorted
2DanaAna
3AnaBen
4ChenChen
5BenDana

After C4 is cleared, the sorted list spills into C2:C5.

Fix. Click the warning icon and choose Select Obstructing Cells, then delete or move what is there. If the blocking cell looks empty, it probably holds a space or a formula that returns empty text; press Delete on it. If the blocking content must stay, move the formula to a place with enough empty room.

Cause 2: the spill range contains merged cells

Dynamic arrays cannot spill into merged cells, even if they are empty. Report layouts often merge cells for headings. Fix: select the area, choose Home › Merge & Center › Unmerge Cells, and use Center Across Selection (in Format Cells › Alignment) if you need the visual effect without merging. Then the formula spills normally.

Cause 3: the formula is inside an Excel table

Excel tables do not support spilled results: every row of a table column is meant to hold one value. A formula such as =UNIQUE(A2:A50) typed in a table column returns #SPILL! with the reason Spill range in table. Fix: put the formula in an ordinary cell outside the table, for example to the right of it with an empty column in between. If you really want the result as a table, convert the table to a range (Table Design › Convert to Range) or load the result with Power Query. Formulas outside a table can happily refer to table columns, such as =UNIQUE(Sales[Region]), and those references grow with the table.

Cause 4: the result is too big for the sheet

A formula that refers to a whole column returns a result as tall as the column: 1,048,576 rows. Entered in row 2 or lower, it cannot fit and returns #SPILL! with Spill range is too big ("extends beyond the worksheet edge"). This is common after people move from older Excel, where =A:A*1.2 quietly used only the value in the same row.

B2fx=A:A*1.2
AB
1PriceWith tax
210#SPILL!
325
440

A full-column result needs 1,048,576 rows, but starts in row 2.

Result: #SPILL!

B2fx=A2:A4*1.2
AB
1PriceWith tax
21012
32530
44048

Refer to the data rows only: 10, 25 and 40 × 1.2.

Fixes, from most to least recommended:

  • Refer to just the data range (A2:A4) or, better, to a table column such as Prices[Price], which grows as data is added.
  • In current Microsoft 365, a trim reference uses a dot to cut off empty rows: =A2:.A10000*1.2 spills only as far as the last value. TRIMRANGE does the same as a function: =TRIMRANGE(A2:A10000)*1.2.
  • If you only want the value from the same row, as old Excel did, add the implicit intersection operator: =@A:A*1.2, then fill the formula down. This gives one result per cell and never spills.
  • The same applies to lookups: =XLOOKUP(A:A, Codes, Prices) returns a million results; use =XLOOKUP(A2, Codes, Prices) and fill down, or =XLOOKUP(A2:A100, Codes, Prices).

Cause 5: the spill size is unknown (volatile size)

Excel must know how many cells a result needs before it can reserve them. If the size itself changes at every recalculation, for example =SEQUENCE(RANDBETWEEN(1, 10)), Excel cannot settle on a spill range and returns #SPILL! with Spill range is unknown. Volatile functions such as RAND, RANDBETWEEN, OFFSET and INDIRECT used to decide the size of a result trigger this. Fix: decide the size from stable inputs (a cell that holds the number of rows), or calculate the random number in a separate cell and refer to it.

Cause 6: out of memory, and Python results

Very large array calculations, such as crossing two columns of 100,000 rows with each other, can exhaust memory; the reason shown is Out of memory. Reduce the size of the ranges, filter first, or move the work to Power Query or a pivot table. In Python in Excel, a PY formula set to return Excel values spills a DataFrame across many cells and shows #SPILL! for the same blocking reasons as any other formula; clear the area or switch the output back to a Python object.

How to find every #SPILL! in a workbook

  1. Go To Special. Press F5 or Ctrl+G (the same on a Mac), click Special, choose Formulas and leave only Errors ticked, then OK. Excel selects every formula on the sheet that shows an error, of any kind. Give the selection a fill colour so the cells stay visible after you click away.
  2. Find All. Press Ctrl+F (Cmd+F), type #SPILL!, open Options, set Look in to Values, tick Match entire cell contents, set Within to Workbook and click Find All. The list at the bottom shows sheet, cell and formula for every hit; Ctrl+A inside the list selects them all.
  3. Error Checking. Formulas › Formula Auditing › Error Checking jumps from one error to the next and offers Show Calculation Steps, which opens Evaluate Formula on that cell so you can see the exact step that fails.
  4. Trace Error. Select an error cell and choose Formulas › Error Checking (the arrow beside it) › Trace Error. Red arrows lead back to the cell where the error started; blue arrows show the healthy inputs. Errors travel downstream, so fixing the first cell often clears dozens of others.
  5. Count them. =SUMPRODUCT(--ISERROR(C2:C500)) counts every error in a range; there is no simple per-type count for #SPILL!, so combine it with Find All to list the cells.
  6. Inspect the planned area. Select the #SPILL! cell: the dashed blue border shows the full range the result needs, which tells you how far to clear or where to move the formula.

When you should NOT hide #SPILL!

Wrapping a spilling formula in IFERROR does not help: the result becomes a single replacement value, and the list you wanted disappears. Worse, in a report, an empty cell where a list of overdue invoices should be looks like "no overdue invoices". Always make room for the spill instead. If you need the formula to survive other people typing near it, give the result its own area or sheet and protect it.

Version notes

  • #SPILL! exists only in Excel versions with dynamic arrays: Microsoft 365, Excel 2021, Excel 2024, Excel for the web and Excel for Mac 2021 or later, plus the mobile apps.
  • In Excel 2019 and older, the same formula entered normally returns a single value (implicit intersection) or must be confirmed as a legacy array with Ctrl+Shift+Enter over a pre-selected range of the right size.
  • When a file with spilled formulas is opened in an older version, the results appear as a legacy array formula in curly braces {=...}; it works until someone edits it.
  • Trim references (A2:.A1000) and TRIMRANGE are recent Microsoft 365 additions; they show #NAME? or are not accepted in older versions.

Check yourself

1. A SORT formula shows #SPILL! and the warning says "Spill range isn't blank". What is the quickest way to find the blocking cell?

2. Why does =A:A*1.2 entered in B2 return #SPILL!?

3. You type =UNIQUE(Sales[Region]) in a column of an Excel table and get #SPILL!. What fixes it?

4. Which of these causes "Spill range is unknown"?

More excel errors