Sub topic 4
The anchor cell and the spill range
This chapter assumes you can enter and edit formulas, use relative and absolute references, and work in Excel for Microsoft 365 or Excel 2021 or later. It covers how a spilling formula is stored, how to find its extent, and what you can and cannot do with the cells it fills.
One formula, one home
When a formula returns more than one value, Excel does not copy the formula into each cell. The formula lives in exactly one cell, the anchor cell. This is the top-left cell of the result. The other cells in the block display values from that formula, but they hold no formulas of their own. The block of cells filled by the result is the spill range.
Try it. In an empty sheet, enter this in D2:
=SEQUENCE(3,2)Excel fills D2:E4 with the numbers 1 to 6, counting across each row. D2 is the anchor. The spill range is D2:E4.
| Cell | Contains | Shows |
|---|---|---|
| D2 | The formula `=SEQUENCE(3,2)` | 1 |
| E2 | Nothing of its own | 2 |
| D3 | Nothing of its own | 3 |
| E4 | Nothing of its own | 6 |
Click E3 and look at the formula bar. You see the formula in a grey, dimmed form: =SEQUENCE(3,2). Excel shows it so you can read it, but you cannot edit it there. The formula is owned by D2.
Seeing the extent of a spill range
When the anchor or any cell in the spill range is selected, Excel draws a thin blue border around the whole spill range. This border is the quickest way to see where the result starts and ends.
The border is a display aid only. It does not appear when you print, and it does not change the data. If you select a cell outside the range, the border disappears.
Three facts help you read a worksheet that someone else built:
- If you click a cell and the formula bar shows a grey formula, the cell is part of a spill range. The anchor is the top-left cell of the blue border.
- If you click a cell and the formula bar shows a normal black formula, you are on an anchor (or on an ordinary formula).
- The size of the spill range is set by the result, not by you. You cannot drag the border to resize it.
How the size is decided
Excel recalculates the anchor formula and then sizes the spill range to match the array it returns. The shape is rows by columns.
Consider a formula that depends on data:
=FILTER(A2:C20,C2:C20>100,"No matches")Suppose six rows pass the test. The result is 6 rows by 3 columns, so the spill range covers 18 cells. If you edit the data so that only two rows pass, the range shrinks to 2 rows by 3 columns on the next recalculation. The cells that are no longer needed become empty. If the data later changes so that ten rows pass, the range grows to 10 rows.
This is the main difference from the pre-2019 approach. A legacy array formula covered a block you selected in advance, and its size was fixed. A spill range follows the result.
The check in the middle is the reason spill ranges can fail. Excel never overwrites cells that hold data. If a destination cell is occupied, the anchor shows #SPILL! and nothing spills. A later chapter covers that error in detail. For now, remember that the anchor needs a clear path to the right and downward.
Editing and deleting a spill range
Because the formula lives only in the anchor, editing works differently from ordinary cells.
- Change the formula: Edit the anchor cell. The spill range updates when you confirm. Editing a grey cell is not possible.
- Delete the result: Select the anchor and press Delete. The whole spill range clears. Selecting a non-anchor cell and pressing Delete does nothing.
- Overwrite a spilled cell: Typing a value into a cell inside the spill range is allowed, but it blocks the spill. The anchor then returns
#SPILL!. Clear the typed value and the spill returns. - Move the result: Cut the anchor cell and paste it elsewhere. The formula and the whole spill range move together. Cutting a non-anchor cell is not possible.
- Copy a spilled value as a plain number: Select the spill range, copy, then use Paste Special with Values. The pasted cells are ordinary constants and no longer follow the formula.
Copying and pasting the anchor creates a new, independent formula. It spills at its new location, so it needs its own free space.
Absolute references and the anchor
The anchor formula uses the same reference rules as any other formula. Relative references are adjusted if you copy the anchor to another cell. Absolute references stay fixed.
If you fill the anchor formula down or across, each copy becomes its own anchor with its own spill range. Those ranges can collide. For example, copying =SEQUENCE(3) from A1 into A2 creates a formula whose spill range would overlap the one from A1. The result is #SPILL!. Most of the time you do not need to fill a spilling formula at all. One formula in one cell is the point.
Spill ranges and tables
Excel tables (created with Insert, Table) do not support spilling formulas. If you enter =SEQUENCE(3) inside a table, Excel returns #SPILL!. Put the formula outside the table, then refer to the table's columns from it. Merged cells block a spill for a similar reason, since the destination cells are not free.
Checking extent with formulas
You often need to know how big a spill range is without looking at the screen. Two functions help, once you can refer to the whole range. The next chapter introduces the # operator that does this. As a preview, this formula counts the rows in the spill range of E2:
=ROWS(E2#)This returns a number that changes when the spill grows or shrinks. It lets other formulas react to the current size of the result.
For now, you can also measure the range directly. Select the anchor, read the blue border, and note the corner cells. You can type the address in the Name Box to confirm.
Common mistakes
- Looking for the formula in every cell. Only the anchor holds it. Click the top-left cell of the blue border.
- Typing into the spill area. Even a space in a cell below the anchor causes
#SPILL!. Cells that look empty may contain a space or a formula returning an empty string. - Placing the anchor too close to other data. A formula that returns 100 rows needs 100 free rows below it.
- Expecting a fixed size. The range grows and shrinks with the source data, so anything placed immediately beneath it can end up blocking it.
- Trying to edit part of the result. You can change the formula in the anchor, but you cannot edit one spilled value on its own. To change a single value, convert the result to constants first with Paste Special Values.
Practice checklist
- Enter
=SEQUENCE(4,3)inB2. Confirm the blue border coversB2:D5. - Click
C4and read the grey formula in the formula bar. - Type
xinD5and watchB2change to#SPILL!. Delete thexto restore the result. - Select
B2and press Delete. Confirm the whole block clears.
Exercise
A formula entered in G3 returns an array of 5 rows by 2 columns, and all destination cells are empty. Which cell is the anchor, what range does the spill occupy, and what happens if you then type a value into H6?
Show answer
The anchor is G3, because it holds the formula and is the top-left cell of the result. The spill range is G3:H7 (5 rows by 2 columns). H6 is inside that range, so typing a value there blocks the spill and G3 shows #SPILL!. Clearing H6 restores the result.
Exercise
A coworker says they cannot edit the cell E5 because the formula bar shows the formula in grey. They want to change the formula. What should they do?
Show answer
E5 is a non-anchor cell of a spill range, so its formula belongs to the anchor. They should select the top-left cell of the blue border around E5, edit the formula there, and confirm. The spill range then updates.
Exercise
A FILTER formula in A1 spilled 8 rows yesterday. Today the source data has only 3 matching rows. What happens to the old rows 4 to 8 of the spill range, and what is one risk of putting a note in A10?
Show answer
The spill range shrinks to 3 rows and the cells in rows 4 to 8 become empty. The risk is that the spill range can grow again, for example to 10 or more rows, and then it would run into the note in A10 and return #SPILL!.