Skip to content

How to Fix Excel #SPILL! Error in Formulas

DodaTech Updated 2026-06-24 3 min read

In this tutorial, you'll learn about How to Fix Excel #SPILL! Error in Formulas. We cover key concepts, practical examples, and best practices.

The #SPILL! error occurs when a dynamic array formula in Excel 365 cannot populate its entire result range. This happens when cells in the spill range contain data, the table is merged, or the spill range extends beyond the worksheet boundary.

The Problem

You type a dynamic array formula and see:

= A1:A10 * B1:B10

Returns:

#SPILL!

Wrong approach — inserting blank rows or columns hoping the spill resolves.

The Fix

Select the formula cell and look for the dashed blue spill range boundary. Check for blocking cells:

1. Click the formula cell → the spill range is outlined
2. Look for non-empty cells inside the spill range
3. Clear, delete, or move the blocking content

If the spill range is blocked by a merged cell, unmerge it:

Home → Merge & Center → Unmerge Cells

If the spill range extends beyond the worksheet, limit the array:

= A1:A1000 * B1:B1000    ← use a smaller range
= A:A * B:B               ← avoids ending at row 1,048,576

For volatile functions like RANDARRAY that change size:

= RANDARRAY(10)   ← explicit size; no unpredictable spill

Expected output:

#SPILL! resolved → formula returns full dynamic array
Spill range is clear and shows all results
No merged cells blocking the result area

Prevention Tips

  • Keep rows and columns below and to the right of dynamic array formulas empty
  • Avoid merged cells in areas where you use dynamic array formulas
  • Use # operator to reference spilled arrays: =SUM(A1#)
  • Set explicit array sizes with SEQUENCE or RANDARRAY(n) instead of open-ended references
  • Convert data to Tables (Ctrl+T) — structured references handle dynamic sizes cleanly

Common Mistakes with spill error

  1. Using return to exit a function early instead of wrapping a pure value in the monad
  2. Mixing let bindings with <- bindings in do notation, producing type errors
  3. Overlapping type class instances that cause GHC to reject the program with ambiguous dispatch errors

These mistakes appear frequently in real-world EXCEL code. DodaTech's contributors have identified these patterns through analysis of open-source projects and production systems.

Practice Exercise

Write a pure function that safely divides two integers using Maybe, then test it with edge cases like division by zero and negative numbers.

This exercise reinforces the concepts covered in this guide. Try implementing it before checking online solutions.

FAQ

### Can I make the spill range dynamic so it grows with data?

Yes, use SEQUENCE with COUNTA to create a dynamic spill: =SEQUENCE(COUNTA(A:A)). This creates an array that grows and shrinks with your data. Combined with INDEX, you can build fully dynamic reports that update automatically.

What does the blue dashed line around my formula mean?

Excel draws a blue dashed border around the spill range when you select a dynamic array formula cell. This shows exactly which cells the formula is trying to fill. Any non-empty cell inside this border causes the #SPILL! error.

Why does my formula spill into merged cells and get blocked?

Merged cells act as a single large cell. A dynamic array cannot spill into a merged cell because the merge occupies more than one row or column. Unmerge the cell or move the formula to a location without merged cells to resolve the spill.

Related: DodaTech's Dynamic Array Analyzer scans workbooks for spill conflicts, suggests spill range adjustments, and converts legacy formulas to dynamic array syntax. Use with DodaZIP for safe workbook transformation.

Built by the developers of DodaTech

Doda Browser, DodaZIP & Durga Antivirus Pro