Sub topic 14
Spill Ranges in Data Validation, Charts and Formatting
This chapter assumes you can write a spilling formula, know the anchor cell, and have used the # operator. You will use spill references in three features that do not read formulas the way a cell does: data validation, charts and conditional formatting.
Why features need the # operator
A feature that points at a fixed range such as E2:E6 keeps that size when the spill grows or shrinks. A reference like E2# follows the spill. Each feature below accepts # in some places and not in others, so the details matter.
The spill must exist before you reference it. If the anchor cell shows #SPILL!, the # reference fails too.
Data validation: a list that follows the data
Suppose E2 holds =SORT(UNIQUE(A2:A20)). To offer those values in a drop-down:
- Select the cell that needs the drop-down.
- Open Data > Data Validation and choose List under Allow.
- In Source, type
=$E$2#. - Click OK.
When new values appear in A2:A20, the spill grows and the drop-down shows them.
Use an absolute reference such as $E$2#. A relative one can shift when the validation is copied to other cells.
=$E$2#The Source box takes only a single column or row. A two-dimensional spill gives an error.
=SORT(UNIQUE(A2:A20))Charts: a series that resizes
Charts do not accept E2# directly in the series box. Create a named range instead.
- Open Formulas > Name Manager > New.
- Name it
ChartValues. - In Refers to, enter
=Sheet1!$E$2#. - Select the chart, edit the series values, and enter
=Sheet1!ChartValues.
Include the workbook or sheet name in the series reference. Excel rejects a bare name there.
=Sheet1!$E$2#Now the chart adds or removes points as the spill changes. This replaces older dynamic-range tricks that used OFFSET and COUNTA.
Conditional formatting: a rule that uses a spill
Conditional formatting rules can contain formulas. Point them at a spill reference to highlight cells that match its values.
Suppose D2 holds a list of flagged items from =FILTER(A2:A20,C2:C20>100,"None"). To highlight matching rows in A2:A20:
- Select A2:A20.
- Choose Home > Conditional Formatting > New Rule > Use a formula.
- Enter the formula below.
=COUNTIF($D$2#,$A2)>0The rule is checked for each cell, with $A2 adjusting by row. The # expands to the whole spill, so new items are highlighted without editing the rule.
Common problems
| Symptom | Likely cause | Fix |
|---|---|---|
| Drop-down shows one item | Source points at the anchor cell only | Use `=$E$2#` |
| Drop-down has an error | The spill is two-dimensional | Spill a single column or row |
| Chart does not update | Series typed with `E2#` directly | Use a named range |
| Rule has no effect | Anchor cell shows `#SPILL!` | Clear the blocking cells |
Exercise
Your drop-down uses the source =$E$2:$E$6 and the spill in E2 now has eight values. What do you change, and why?
Show answer
Change the source to =$E$2#. A fixed range keeps its size, so only five values appear. The spill reference grows and shrinks with the formula.
Exercise
You type =Sheet1!$E$2# directly into a chart series and Excel rejects it. How do you get a chart that follows the spill?
Show answer
Create a named range, such as ChartValues, that refers to =Sheet1!$E$2#. Then enter =Sheet1!ChartValues as the series values.