#SPILL! error in Excel: what it means and how to fix it
#SPILL! means a formula's result needs more cells than are free. Here's how to find what's in the way, the other causes of #SPILL!, and how to fix each one.
Nest SORT, UNIQUE and FILTER, inside out: =SORT(UNIQUE(FILTER(A2:A9,B2:B9=F1))). FILTER keeps the customers whose region is the one in F1, UNIQUE lists each of them once, and SORT puts them A to Z. The result spills down as many cells as it needs and updates the moment an order or the region in F1 changes. Wrap it in ROWS to count the customers instead of listing them.
“Here’s this quarter’s order list. On a summary sheet, list the customers who ordered in whichever region I type in a cell, each one once, alphabetically. It should update by itself when new orders come in.”
The older version of this question expects a pivot table or Remove Duplicates. If the company runs Microsoft 365, the interviewer usually wants to see whether you know there’s now a one-formula answer.
The orders are in A1:C9 and the region to show in F1. Say each step out loud as you add it. First, FILTER keeps the names of the West orders, repeats and all:
| Row | A | B | C | D | E | F |
|---|---|---|---|---|---|---|
| 1 | Customer | Region | Amount | Region | West | |
| 2 | Rowan Ltd | West | 820 | |||
| 3 | Atlas Co | East | 450 | Rowan Ltd | ||
| 4 | Mira Foods | West | 1300 | Mira Foods | ||
| 5 | Rowan Ltd | West | 640 | Rowan Ltd | ||
| 6 | Kite Labs | North | 980 | Atlas Co | ||
| 7 | Atlas Co | West | 300 | Mira Foods | ||
| 8 | Mira Foods | West | 210 | |||
| 9 | Orbit Inc | East | 760 |
UNIQUE around it lists each customer once, in the order they first appear:
=UNIQUE(FILTER(A2:A9,B2:B9=F1)) → Rowan LtdSORT around that puts them A to Z. That’s the whole answer:
| Row | A | B | C | D | E | F |
|---|---|---|---|---|---|---|
| 1 | Customer | Region | Amount | Region | West | |
| 2 | Rowan Ltd | West | 820 | |||
| 3 | Atlas Co | East | 450 | Atlas Co | ||
| 4 | Mira Foods | West | 1300 | Mira Foods | ||
| 5 | Rowan Ltd | West | 640 | Rowan Ltd | ||
| 6 | Kite Labs | North | 980 | |||
| 7 | Atlas Co | West | 300 | |||
| 8 | Mira Foods | West | 210 | |||
| 9 | Orbit Inc | East | 760 |
Type another region in F1 and the list changes size to fit. To pick up new orders as well, turn the data into a table (Ctrl+T) and point the formula at its columns, such as Orders[Customer]: a table’s columns grow as rows are added.
Wrap the list in ROWS, or COUNTA, and you get a count instead of a list:
=ROWS(UNIQUE(FILTER(A2:A9,B2:B9=F1))) → 3The West region has five orders from three customers. A COUNTIF on the region would say five, which answers a different question.
With a region that has no orders, FILTER has nothing to return, and without a fallback it shows #CALC!. Its third argument is what to show instead:
=FILTER(A2:A9,B2:B9=F1,"No orders") → No ordersThe count needs the same care. COUNTA counts an error as a value, so for a region with no orders it says 1 customer, with or without the fallback. Count with ROWS and catch the #CALC! with IFERROR, and an empty region shows 0:
=IFERROR(ROWS(UNIQUE(FILTER(A2:A9,B2:B9=F1))),0) → 0Remove the repeats first and then try to filter, and FILTER gets a list of names that no longer lines up with the regions beside it. The ranges are different sizes, so it returns #VALUE!:
=FILTER(UNIQUE(A2:A9),B2:B9=F1)#VALUE!=SORT(UNIQUE(FILTER(A2:A9,B2:B9=F1)))Atlas CoFilter while the names still sit next to their regions, then take UNIQUE of what’s left.
A different order list and a count instead of a list. We check your count, then switch the region and change a customer’s name.
Your task: In E2, count how many different customers ordered in the region in E1.
Graded live| Row | A | B | C | D | E |
|---|---|---|---|---|---|
| 1 | Customer | Region | Region | East | |
| 2 | Lumen AG | East | Customers | ||
| 3 | Bay Traders | West | |||
| 4 | Lumen AG | East | |||
| 5 | Northwind | East | |||
| 6 | Peak Supply | North | |||
| 7 | Bay Traders | East | |||
| 8 | Northwind | East | |||
| 9 | Cedar Ltd | West | |||
| 10 | Lumen AG | East |
Write the formula in the bar above, then press Check or Enter.
FILTER(A2:A10,B2:B10=E1) keeps the region's names, UNIQUE lists each once, and ROWS (or COUNTA) counts them.
=ROWS(UNIQUE(FILTER(A2:A10,B2:B10=E1))) Any formula that returns the same result passes.
“FILTER to the region in F1, UNIQUE so each customer shows once, SORT for A to Z, all in one cell, and it spills. I’d give FILTER a fallback for a region with no orders, and keep the cells below it clear.” If they ask for an older version, say pivot table or Remove Duplicates, and that neither updates by itself. More questions like this one: Excel interview questions.
No. They need Excel 365, Excel 2021 or later, or Excel for the web. Older versions show #NAME?. There, a pivot table or Remove Duplicates gets you the same list, but it won't update by itself.
Remove Duplicates deletes rows from your data, once. UNIQUE leaves the data alone and returns a list that updates whenever the data changes.
Multiply the tests for AND, add them for OR: =FILTER(A2:A9,(B2:B9="West")*(C2:C9>500)) keeps West orders over 500.
Ask what the list is for. If it must update by itself, a pivot table needs refreshing and Remove Duplicates is a one-off, so the formula is the answer they want. Offering both, and saying why you'd pick one, shows judgement.
Guides that build on this one.
#SPILL! means a formula's result needs more cells than are free. Here's how to find what's in the way, the other causes of #SPILL!, and how to fix each one.
Turn a raw sales list into a summary by region and product, without a pivot table. The formula interviewers expect, the $ signs that make it copy, and a sheet that grades yours.
XLOOKUP does everything VLOOKUP does with fewer ways to go wrong. Here's the same lookup written both ways, the five differences that matter, and when VLOOKUP is still the right call.
Practise in a live grid that grades what your formula calculates, with a specific hint when it's wrong.
Runs in your browser · Graded on your result · No install