Tabellab

Spill Basics: One Formula, Many Cells, and the #SPILL! Error

Lesson 1 of 20Lab

All lessons
  1. Spill Basics: One Formula, Many Cells, and the #SPILL! ErrorLabFree
  2. SORT & SORTBY: Largest First, Two Sort Keys and Custom OrdersLab Locked
  3. FILTER: Criteria Cells, AND / OR Conditions and "If Empty"Lab Locked
  4. UNIQUE: Distinct Lists, Distinct Counts and "Exactly Once"Lab Locked
  5. SEQUENCE: Numbering, Date Series and a Monthly CalendarLab Locked
  6. Spill References (A1#): A Region Summary That Grows by ItselfLab Locked
  7. Report Building: VSTACK, DROP, CHOOSECOLS, TAKE and HSTACKLab Locked
  8. Mid-course project: A Dynamic Top-N Dashboard with a ChartLab Locked
  9. FILTER with Text and Lists: Contains, In a List and Not in a ListLab Locked
  10. Date Windows: Between Two Dates, Month-to-Date and the Latest OrdersLab Locked
  11. Lookups for a Whole List: XLOOKUP with Many Lookup Values at OnceLab Locked
  12. Array Grids: Column × Row Broadcasting for Price-Break and Profit TablesLab Locked
  13. Reshaping Arrays: TOCOL, WRAPROWS and Grids into ListsLab Locked
  14. CHOOSEROWS and EXPAND: Every n-th Row, the Last Rows and Fixed-Size BlocksLab Locked
  15. Errors Inside Spills: #DIV/0! per Row, #CALC! from Empty Results and Safe TotalsLab Locked
  16. Order-Size Bands: SEQUENCE Bounds, COUNTIFS on Whole Arrays and a HistogramLab Locked
  17. Control Checks for Array Reports: Row Counts, Duplicate Rows and Control TotalsLab Locked
  18. Optional Criteria: "All" Choices, a Sort-Column Picker and a Direction SwitchLab Locked
  19. Array Logic: IF over Whole Columns, Year-on-Year Change and a Ranked Bar ChartLab Locked
  20. Final Project: A Region Dashboard with Criteria, KPIs, a Top-5 List and a ChartLab Locked

You are not signed in — the lab works, but your progress is not saved. Sign up

Lesson 1 of 20 is free. Unlock all 20 hands-on labs, the final exam and your certificate.

Buy course — CHF 9.90
Loading the spreadsheet…

Stop copying formulas down: let Excel fill the cells for you

For decades, the Excel routine was the same: write a formula in the first row, drag the fill handle down, hope the range is long enough, and redo it all when the list changes. Sorting meant clicking Data > Sort and overwriting the original order. Dynamic arrays changed that. One formula can now return a whole list, a whole table or a whole calendar, and Excel places the results in the cells around it. This is called spilling, and it is the foundation of FILTER, SORT, UNIQUE, SEQUENCE and every modern Excel report.

This free first lesson is for anyone who works with lists that change: sales reports, price lists, customer exports, inventory. If you have ever had a total that missed the last row because someone added data below the range, or a sorted list that went stale because the source changed, spill formulas fix both problems. You need Microsoft 365, Excel 2021 or later, or Excel for the web; older versions such as Excel 2019 do not spill.

Our example comes from the lab above: Lumen Tea Co., a fictional tea wholesaler with eight teas. Column B holds the kilograms sold, column C the price per kilogram. The sales team still sorts its monthly list by hand, and last month's hand-sorted numbers are still sitting in the sheet. We replace that work with two spill formulas and a total that never misses a row.

The core concept: one formula, many cells

A normal formula returns one value into one cell. A dynamic array formula returns several values. When you type =SORT(B2:B9,1,-1) into D2, the function produces eight sorted numbers, and Excel shows them in D2:D9. Only D2 contains the formula; it is called the anchor. The cells D3:D9 show results but hold nothing you can edit. Excel draws a thin blue border around the whole spill range when you select any cell inside it, and in the formula bar the ghost cells show the anchor's formula in grey.

Two consequences follow. First, the spill range resizes itself: if the source grows from eight to ten teas and your formula refers to the larger range, the result spills two rows further without any copying. Second, the spill range needs empty cells. If even one cell in its path holds something, Excel refuses to overwrite it and shows #SPILL! in the anchor instead. That is not a bug; it protects your data.

One formula in D2, eight results, unless something is in the wayD3:D9 empty: the list spillsD2: =SORT(B2:B9,1,-1)24253380431052606230719081459120← anchor (formula)← grey "ghost" cells:results, no formulaD6 holds 412: #SPILL!D2: =SORT(B2:B9,1,-1)2#SPILL!3456412789← blocking cell← anchor shows error
Left: the anchor D2 holds the formula and the ghost cells show its results. Right: one leftover number in D6 blocks the whole spill.

Spilling is not limited to the new functions. Ordinary arithmetic on ranges spills too. =B2:B9*C2:C9 multiplies row 2 with row 2, row 3 with row 3 and so on, and returns eight revenues at once. Before dynamic arrays this needed a helper column copied down or a legacy array formula confirmed with Ctrl+Shift+Enter. Now you just press Enter.

Old way versus new way

To see why this matters, compare how Lumen's team worked before. To rank the kilograms, someone copied column B, pasted it as values into D, and ran Data > Sort. The list was correct for exactly one day: when a sales figure was corrected, column D did not change, and nobody noticed until a customer asked why the ranking looked odd. The 412 still sitting in D6 in the lab is a leftover of exactly that process. For the revenue, someone wrote =B2*C2 in F2 and dragged it to F9; when a ninth tea was added, the formula was not extended and the total was short by one product.

With dynamic arrays both jobs become one formula each, and both are live: change a kilogram figure in column B and the sorted list, the revenue and the total update together. There is nothing to drag, nothing to re-sort and no range to extend by hand. You also get a simpler sheet to audit, because there are two formulas to check instead of sixteen copies that might differ from each other. That last point is easy to underestimate: in a copied-down column, one overwritten cell in the middle can hide for months, while a spill range cannot contain a stray hand-typed value at all.

Worked example: Lumen Tea Co.'s sorted list and revenue

Here is the sheet after the lab is finished. Column D is one SORT formula in D2, column F is one multiplication in F2, and the total is a SUM over the spill reference F2#. Note that D is sorted on its own, so the kilograms in D no longer line up with the tea names in A; that is fine for a ranked list of numbers, and in the next lesson you sort whole rows instead.

RowTea (A)Kg sold (B)Price per kg (C)Kg, sorted (D)Revenue (F)
2Assam Breakfast38018.50=SORT(B2:B9,1,-1) → 425=B2:B9*C2:C9 → 7,030.00
3Darjeeling First Flush14542.003806,090.00
4Sencha Kyoto26028.003107,280.00
5Jasmine Pearls19036.502606,935.00
6Earl Grey Supreme42521.002308,925.00
7Rooibos Vanilla31016.501905,115.00
8Oolong Tieguanyin12048.001455,760.00
9Chamomile Gold23019.501204,485.00
Total2,060=SUM(F2#) → 51,620.00

The total of 51,620 is =SUM(F2#). The hash after the anchor means "the whole range that F2 spilled, however big it is today". If Lumen adds two teas and you change F2 to =B2:B11*C2:C11, the spill grows to F2:F11 and the total follows without being touched. A classic =SUM(F2:F9) would silently ignore the new rows. The prices are fictional, for practice only.

Revenue per tea (F2# = B2:B9*C2:C9), total 51,62002,5005,0007,50010,000Earl Grey Supreme8,925Sencha Kyoto7,280Assam Breakfast7,030Jasmine Pearls6,935Darjeeling First Flush6,090Oolong Tieguanyin5,760Rooibos Vanilla5,115Chamomile Gold4,485
Revenue per tea from the single spill formula in F2. Earl Grey Supreme sells the most kilograms and also brings the most revenue.

Step by step: spill, fix #SPILL! and total with F2#

  1. Click D2 and type =SORT(B2:B9,1,-1), then press Enter (not Ctrl+Shift+Enter). The arguments mean: sort B2:B9, by its first column, in descending order (-1). Leave them out and SORT sorts ascending.
  2. D2 shows #SPILL!. Click D2: a dashed border marks the range D2:D9 that the formula wants to fill.
  3. Click the small warning icon next to D2 and choose Select Obstructing Cells. Excel selects D6, which still holds 412 from last month's hand-sorted list.
  4. Press Delete. The list spills immediately: 425, 380, 310, 260, 230, 190, 145, 120.
  5. Click D9. The formula bar shows the formula in grey: D9 is a ghost cell. Do not type into it; that would block the spill again.
  6. Click F2 and type =B2:B9*C2:C9, then Enter. Eight revenues appear in F2:F9. Format them as currency with Ctrl+Shift+$ on Windows or Home > Number Format. Format the whole column, because a growing spill brings new cells.
  7. Click I2 and type =SUM(, then select F2:F9 with the mouse. Because it is a spill range, Excel writes F2# for you. Close the bracket and press Enter: 51,620.
  8. Press Ctrl+` to show formulas. Only D2 and F2 show a formula; every other result cell is generated. Press it again to switch back.
To delete a spilled list, delete the anchor. Pressing Delete on a ghost cell does nothing, because the cell has no content of its own. If you want the results as fixed values, copy the spill range and use Paste Special > Values.

What else spills: a preview with the same data

The lesson uses SORT and simple arithmetic, but every function in this course works the same way: one formula, a spill range, a # reference to use it elsewhere. Here is what the next lessons do with Lumen's eight teas:

FormulaResult
=SORT(A2:C9,2,-1)The whole table, largest kilograms first: Earl Grey Supreme (425) at the top, Oolong Tieguanyin (120) at the bottom.
=SORTBY(A2:A9,B2:B9*C2:C9,-1)Tea names ranked by revenue, sorted by a calculation that is not shown.
=FILTER(A2:B9,B2:B9>=300,"None")Only teas with at least 300 kg: Assam Breakfast, Earl Grey Supreme, Rooibos Vanilla.
=TAKE(SORTBY(A2:A9,B2:B9*C2:C9,-1),3)Top three by revenue: Earl Grey Supreme, Sencha Kyoto, Assam Breakfast (TAKE needs Microsoft 365 or Excel 2024).
=SEQUENCE(8)The numbers 1 to 8 in one column, for ranking or numbering.
=AVERAGE(F2#)Average revenue per tea: 6,452.50.

Excel dynamic arrays course: FILTER, SORT, UNIQUE and SEQUENCE spilling results into a sheet
From one spilled column to a self-updating top-N dashboard: the path of this course.

Every reason for #SPILL! and how to fix it

The error is always shown in the anchor, and the warning menu tells you which kind it is. These are the cases you will meet in practice:

MessageCauseFix
Spill range isn't blankA value, a formula, a space or an apostrophe sits in the way.Click the warning icon > Select Obstructing Cells, then delete them.
Spill range has merged cellsA spill cannot flow through merged cells.Unmerge the cells (Home > Merge & Center).
Spill range in tableSpilling formulas are not supported inside an Excel table.Put the formula next to the table, or convert the table to a range.
Extends beyond the worksheet's edgeThe result would need more rows or columns than the sheet has, often from a whole-column reference like A:A in the wrong place.Reference only the rows you need, or move the anchor.
Spill range is unknownThe size of the result keeps changing, for example SEQUENCE driven by RANDBETWEEN.Use a fixed or non-volatile size.

Common mistakes and how to spot them

  • Copying a spill formula down. Old habits die hard: if you copy D2 to D3, the copy sits inside D2's spill range, so D2 shows #SPILL!, and the copy sorts the shifted range B3:B10. Spot it: select a ghost cell; if the formula bar shows black (editable) text instead of grey, someone typed or pasted there.
  • Invisible blockers. A single space or an apostrophe in a cell looks empty but blocks the spill. Spot it: Select Obstructing Cells highlights it even though you see nothing.
  • Mixing range sizes. =B2:B9*C2:C8 multiplies eight rows by seven; the missing row returns #N/A. Spot it: an error at the bottom of an otherwise correct spill.
  • Using a single cell where a range belongs. =B2:B9*C2 prices every tea with the Assam price of 18.50. The result looks plausible, which is what makes it dangerous. Spot it: check one row by hand, for example Oolong should be 120 × 48 = 5,760.
  • Fixed ranges after a spill. =SUM(F2:F9) works today but misses rows when the spill grows. Use =SUM(F2#).
  • The @ sign in old workbooks. Formulas written in older Excel may open with an @ in front of a range, for example =@B2:B9. That is implicit intersection, the old one-value behaviour, kept for compatibility. Remove the @ only if you really want the formula to spill.
Sharing with someone on Excel 2019 or earlier? They can open the file, but spill formulas appear as legacy array formulas in curly braces and the newest functions show #NAME?. If your colleagues are on older versions, check before you build a report on dynamic arrays.

Quick reference: dynamic array functions and shortcuts

Function, reference or shortcutWhat it does
SORT(array,[sort_index],[sort_order],[by_col])Sorts a range; sort_order 1 ascending, -1 descending.
SORTBY(array,by_array,[order],…)Sorts by another range or a calculation, several keys allowed.
FILTER(array,include,[if_empty])Keeps the rows where include is TRUE.
UNIQUE(array)Distinct values of a list.
SEQUENCE(rows,[columns],[start],[step])A grid of sequential numbers.
B2:B9*C2:C9Row-by-row arithmetic that spills.
F2#Spill reference: the whole current spill range of the formula in F2.
Select a spill range while typing a formulaExcel writes the # reference for you.
Warning icon > Select Obstructing CellsFinds what blocks a #SPILL!.
Ctrl+` (grave accent)Show formulas: only the anchor displays a formula.

Real-world uses of spill formulas

  • Ranked sales lists: a sales manager keeps the raw export untouched and shows a ranked list next to it with SORT or SORTBY. When next month's data is pasted in, the ranking updates itself.
  • Filtered views without the filter button: a buyer sees only the products below the reorder level with =FILTER(Products,Stock<ReorderLevel,"Nothing to order"), while the full list stays intact for everyone else.
  • Distinct lists for drop-downs: UNIQUE extracts the current list of customers or regions, and a Data Validation list that points to the spill reference (for example =$E$2#) grows when a new customer appears.
  • Calendars and schedules: SEQUENCE generates every delivery date, invoice date or day of a month from one start date, without dragging anything.
  • Self-updating summaries: a region summary built on UNIQUE with SUMIFS(…,E2#) next to it adds a row by itself when a new region appears in the data.

What you will build in the rest of this course

SORT & SORTBY: Largest First, Two Sort Keys and Custom Orders. You sort Lumen's customer list by revenue, by region and revenue at once, by a key that is not even in the output, and by a custom region order that is not alphabetical.

FILTER: Criteria Cells, AND / OR Conditions and "If Empty". You extract orders for one region from a criteria cell, combine conditions with * for AND and + for OR, and show a friendly message instead of #CALC! when nothing matches. This is the lesson that replaces most AutoFilter clicking.

UNIQUE: Distinct Lists, Distinct Counts and "Exactly Once". You pull the distinct customers and teas from order lines, count customers with ROWS(UNIQUE()), and find the customers who ordered only once, a question that used to need a pivot table.

SEQUENCE: Numbering, Date Series and a Monthly Calendar. You generate lot numbers, a weekly delivery schedule, month-end invoice dates and a Monday-first calendar grid, each from one formula driven by settings cells.

Spill References (A1#): A Region Summary That Grows by Itself. You build a summary on one UNIQUE list with SUMIFS over E2#, shares over F2# and the top region with XLOOKUP, so a new region appears without editing a single formula.

Report Building: VSTACK, DROP, CHOOSECOLS, TAKE and HSTACK. You stack two months of orders into one table, pick the columns for a short report, extract the top three orders and build a one-row summary, all with the newest Microsoft 365 functions.

Mid-course project: A Dynamic Top-N Dashboard with a Chart. You build a Q4 top-N panel driven by one number: change N and the TAKE(SORT()) formula, the share column, the top-N share of revenue and the bar chart all update together. You finish with the Tabellab certificate in Excel dynamic arrays.

Summary: try the lab above

A dynamic array formula returns several values that spill from the anchor cell into empty cells below and to the right. Only the anchor holds the formula; the ghost cells just show results. If anything stands in the way, the anchor shows #SPILL! until you clear the blocking cell. Arithmetic on ranges like =B2:B9*C2:C9 spills too, and the spill reference F2# lets totals and other formulas follow the list as it grows or shrinks.

Scroll up and do it in the lab: sort Lumen's kilograms with one SORT formula, clear the leftover 412 that blocks it, spill the revenue of all eight teas and total it with SUM(F2#). It takes about fifteen minutes, the Coach checks every cell, and you will never drag a formula down a column in quite the same way again.

Frequently asked questions

What is a dynamic array formula in Excel?

It is a formula that returns several values at once. Excel places the results in the cells below and to the right of the formula cell, which is called spilling. Examples are SORT, FILTER, UNIQUE, SEQUENCE and range arithmetic like =B2:B9*C2:C9.

What does #SPILL! mean in Excel?

The formula wants to return several values, but at least one cell in the spill range is not empty, is merged or lies inside an Excel table. Select the anchor cell, click the warning icon and choose Select Obstructing Cells to find and clear the blocker.

What does the # sign after a cell reference mean, like F2#?

F2# is a spill reference: it refers to the whole range that the formula in F2 currently spills. =SUM(F2#) keeps working when the spilled list grows or shrinks.

Which Excel versions support dynamic arrays?

Microsoft 365, Excel 2021, Excel 2024 and Excel for the web support spilling. Some newer functions such as TAKE, VSTACK and HSTACK need Microsoft 365 or Excel 2024. Excel 2019 and earlier do not spill.

Can I edit a single cell inside a spill range?

No. Only the anchor cell holds the formula. Typing into a ghost cell blocks the spill and the anchor shows #SPILL!. To change the results, edit the formula in the anchor.

Do I still need Ctrl+Shift+Enter for array formulas?

Not in versions with dynamic arrays. Press Enter as usual and the formula spills. Ctrl+Shift+Enter is only needed for legacy array formulas in Excel 2019 and earlier.

Keep going: Excel Dynamic Arrays: FILTER, SORT, UNIQUE, SEQUENCE & Spill Ranges

This free lab is lesson 1 of 20. Unlock the other 19 hands-on labs, the final exam and your certificate for a one-time CHF 9.90.

  1. SORT & SORTBY: Largest First, Two Sort Keys and Custom Orders
  2. FILTER: Criteria Cells, AND / OR Conditions and "If Empty"
  3. UNIQUE: Distinct Lists, Distinct Counts and "Exactly Once"
  4. SEQUENCE: Numbering, Date Series and a Monthly Calendar
  5. Spill References (A1#): A Region Summary That Grows by Itself
  6. Report Building: VSTACK, DROP, CHOOSECOLS, TAKE and HSTACK
  7. Mid-course project: A Dynamic Top-N Dashboard with a Chart
  8. FILTER with Text and Lists: Contains, In a List and Not in a List
  9. Date Windows: Between Two Dates, Month-to-Date and the Latest Orders
  10. Lookups for a Whole List: XLOOKUP with Many Lookup Values at Once
  11. Array Grids: Column × Row Broadcasting for Price-Break and Profit Tables
  12. Reshaping Arrays: TOCOL, WRAPROWS and Grids into Lists
  13. CHOOSEROWS and EXPAND: Every n-th Row, the Last Rows and Fixed-Size Blocks
  14. Errors Inside Spills: #DIV/0! per Row, #CALC! from Empty Results and Safe Totals
  15. Order-Size Bands: SEQUENCE Bounds, COUNTIFS on Whole Arrays and a Histogram
  16. Control Checks for Array Reports: Row Counts, Duplicate Rows and Control Totals
  17. Optional Criteria: "All" Choices, a Sort-Column Picker and a Direction Switch
  18. Array Logic: IF over Whole Columns, Year-on-Year Change and a Ranked Bar Chart
  19. Final Project: A Region Dashboard with Criteria, KPIs, a Top-5 List and a Chart

Buy course — CHF 9.90 See the full course