Skip to main content

📊 Lesson 4.4: Dynamic Arrays — FILTER, SORT & UNIQUE (Excel's Modern Power)

This lesson shows off the most exciting thing to happen to Excel formulas in decades. A dynamic array formula returns not one value but a whole list — and it "spills" that list automatically into the cells below and beside it. Write one FILTER and a live, self-resizing table of matching rows appears. Add SORT and UNIQUE and you can build summaries that used to need helper columns or a PivotTable — from a single formula that updates itself the instant your data changes.

📚 What You'll Learn

By the end of this lesson, you will be able to:

  • Explain what a dynamic array is — a formula that spills results into a range
  • Use the spill range, the # spilled-range reference, and diagnose the #SPILL! error
  • Return matching rows with FILTER, order results with SORT / SORTBY, and distill distinct values with UNIQUE
  • Generate number series with SEQUENCE and combine these functions (e.g. sort a filtered, unique list)
  • Judge honestly when to use dynamic arrays versus the old helper-column / PivotTable approach

⏱️ Estimated Time: 50 minutes

🎯 Project: Build a live "spilled" summary — a unique, sorted list of categories, or a filtered view of your table — that updates itself automatically.

In This Lesson

What Dynamic Arrays Are — Spilling

For its whole history, one Excel formula lived in one cell and produced one result. If you wanted a list of answers, you copied the formula down a column, once per row. Dynamic arrays change that completely. A dynamic array formula can return many values at once, and Excel automatically places them into the neighboring cells — a behavior called spilling. You write the formula in a single cell, press Enter, and a whole range of results appears, flowing down (and sometimes across) from where you typed.

Here's the simplest possible demonstration. If A2:A6 contains five numbers and you type, in a single empty cell, =A2:A6*2, older Excel would complain — but modern Excel returns all five doubled values, spilling them down five cells from where you stood. You didn't copy anything down; one formula produced the whole column. The cell where you typed it is the anchor; the cells it fills are the spill range.

Why is this such a big deal? Because it means a single formula can produce a live, self-sizing list. If the source data grows from five rows to fifty, the spill range grows to match — no re-copying, no dragging, no stale ranges. Combined with the functions we meet below (FILTER, SORT, UNIQUE), spilling lets one cell generate an entire summary table that maintains itself. This is the modern heart of Excel, and it's where Excel and Google Sheets both went in the same direction.

⚠️ Availability — read this first

Dynamic arrays and the functions in this lesson (FILTER, SORT, SORTBY, UNIQUE, SEQUENCE) require Microsoft 365 or Excel for the web (both the free and paid tiers on the web have them). They are also in Excel 2021/2024. They do not exist in older perpetual versions like Excel 2019, 2016, or earlier — there they show a #NAME? error, and those versions require the older helper-column or PivotTable approach we compare at the end. This is one of the clearest places the modern subscription/web Excel pulls ahead of the old perpetual apps.

The Spill Range, the # Reference & #SPILL!

Three ideas make working with spills comfortable. Learn them once and dynamic arrays feel natural.

The spill range

When a formula spills, all the result cells belong to one formula. Click any spilled cell and you'll see the formula grayed out — you can only edit it in the top-left anchor cell, and a faint blue border outlines the whole spill range. You never type into the spilled cells yourself; they're owned and refreshed by the anchor formula.

The # spilled-range reference

Because a spill range changes size as data grows, you need a way to refer to "however many cells this spill currently covers." That's the spilled-range operator: put a # after the anchor cell. If a UNIQUE formula in E2 spills a list of categories, then E2# means "the entire spilled list, whatever its current length." So =COUNTA(E2#) counts the categories and stays correct as the list grows or shrinks. The # reference is how you chain spills together and build summaries that never need re-pointing.

The #SPILL! error

A spill needs empty space to expand into. If something is already sitting in the cells where the results want to go, Excel can't spill and shows #SPILL! instead. The fix is almost always simple: clear whatever is blocking the spill range (a stray value, a label, merged cells), and the results appear. Excel usually highlights the obstructing cells for you.

ConceptWhat it meansExample
Anchor cellWhere you type the formula; owns the spillE2
Spill rangeAll the cells the results fillE2:E9 (auto-sized)
# referenceThe whole spilled range, whatever its sizeE2#
#SPILL!Something is blocking the spill areaClear the cells in the way

🧠 One formula, one living list

The mental shift is this: instead of "a formula per row," think "one formula that produces the whole list, and keeps it the right size forever." Refer to that living list with #, give it room to breathe, and you rarely touch it again — the data changes and the list follows.

FILTER — Rows That Match a Condition

FILTER is the star of the show. Give it a range and a condition and it returns — spilled — every row that meets the condition, and only those rows. It's a live version of the manual filtering you learned in Lesson 3.1, except the results are a real range you can feed into other formulas and charts. Its syntax:

=FILTER(array, include, [if_empty])
  • array — the range to return rows from (can be one or many columns)
  • include — a condition the same height as the array; rows where it's TRUE are kept
  • [if_empty] — what to show when nothing matches (optional but recommended)

Say your data sits in A2:D50 with the category in column B. To spill every row whose category is "Lighting":

=FILTER(A2:D50, B2:B50="Lighting", "No matches")

All matching rows appear below your formula, resizing automatically as the data changes. The condition is a comparison across the whole column — exactly the TRUE/FALSE thinking from Lesson 4.3, now applied to a range. You can combine conditions with arithmetic: multiply two conditions for and ((B2:B50="Lighting")*(D2:D50>10)), add them for or. To pull just one column of the matches, point array at that single column, e.g. =FILTER(A2:A50, B2:B50="Lighting") returns only the codes.

graph LR A["Full data
A2 to D50"] --> B["FILTER
keep rows where
category is Lighting"] B --> C["Spilled result
only matching rows,
auto-resizing"]

This alone replaces a surprising amount of manual work. Instead of applying a filter, copying the visible rows, and pasting them elsewhere — then redoing it all when the data changes — you write one FILTER and the extract stays live forever.

SORT, SORTBY, UNIQUE & SEQUENCE

FILTER has a family of companion functions, each doing one clean job on a spilled list:

FunctionWhat it doesExample
SORT Returns a range sorted by a column =SORT(A2:D50, 4, -1) — by column 4, descending
SORTBY Sorts one range by the values in another =SORTBY(A2:A50, D2:D50, -1) — codes ordered by price, high to low
UNIQUE Returns the distinct values from a range (drops duplicates) =UNIQUE(B2:B50) — each category once
SEQUENCE Generates a series of numbers as a spilled array =SEQUENCE(12) — the numbers 1 through 12

SORT takes the range, an optional column index to sort by, and a direction (1 for ascending, -1 for descending). SORTBY is handier when you want to sort one list by a different list — say, product names ordered by their sales — because you name the ranges directly rather than counting columns. UNIQUE is the one that unlocks summaries: hand it a messy column of repeated categories and it spills a clean list of each distinct value exactly once — the perfect row labels for a summary table. And SEQUENCE conjures number series (great for numbering rows, building date ladders, or feeding other formulas).

💡 Where this fits the journey

On our Data → Formulas → Analysis → Visualization → Dashboard map, dynamic arrays straddle Formulas and Analysis. A UNIQUE + SORT combo produces the category axis of a summary; a FILTER produces a live extract to chart. These are the formulas that will make your capstone dashboard feel effortless and always-current.

Combining Them & the Old Way Compared

The real magic appears when you nest these functions — the output of one becomes the input of the next. Because each returns a spilled range, they compose beautifully. A classic, genuinely useful pattern is a sorted, unique list of categories:

=SORT(UNIQUE(B2:B50))

Read it inside-out: UNIQUE distills the category column down to each distinct value, then SORT puts that list in order — one formula, one living, alphabetized list of categories. Take it a step further and filter before distilling, to get the sorted, unique list of categories among only the paid orders:

=SORT(UNIQUE(FILTER(B2:B50, E2:E50="Paid")))

That single cell now maintains a clean, ordered, de-duplicated summary that updates the instant any order's status changes. Pair it with the # reference and the SUMIFS from Lesson 4.3 — =SUMIFS($D$2:$D$50, $B$2:$B$50, E2#) next to a spilled category list — and you have a complete, self-building summary table with almost no manual upkeep.

The old way, honestly

How did people do this before dynamic arrays? A few ways, all clunkier. To get a unique list you'd use Remove Duplicates (a one-time command that goes stale the moment data changes) or an Advanced Filter, or a helper column with a COUNTIF trick, then sort manually. To summarize by category you'd build a PivotTable — still an excellent tool (Lesson 5.1 is devoted to it) — but a PivotTable must be refreshed to reflect new data, whereas a dynamic-array summary is always live. Neither old approach was wrong; they were just more steps and more re-doing.

TaskOld wayDynamic-array way
Distinct list of categoriesRemove Duplicates (static) or a helper column=UNIQUE(B2:B50) (live)
Extract matching rowsApply a filter, copy, paste elsewhere=FILTER(A2:D50, cond) (live)
Sorted summary by categoryPivotTable — must be refreshedUNIQUE+SORT+SUMIFS (auto)

⚠️ When the old way still wins

Dynamic arrays are wonderful, but they need Microsoft 365 / the web. If you must share with people on older Excel, a PivotTable or helper columns are the compatible choice — and PivotTables still shine for heavy, interactive, drag-and-drop exploration of big data. Use dynamic arrays for live, formula-driven summaries; use PivotTables for exploratory, refreshable analysis. They complement each other.

🎯 Project: A Live Spilled Summary

Let's build something that would have taken a dozen manual steps before — and here takes one or two formulas. You'll create a self-maintaining summary from your tracker: a unique, sorted list of categories (with totals), or a live filtered view of your table. Either way, editing the data will update it automatically, with no dragging or refreshing.

🏋️ Build a self-updating summary

Objective: Use dynamic-array functions to spill a live summary that resizes and updates on its own as your data changes.

Instructions (about 20 minutes):

  1. (2 min) Confirm you're on Microsoft 365 or Excel for the web — type =SEQUENCE(3) in a spare cell; if you see 1, 2, 3 spill down, you're good. (If you get #NAME?, use the PivotTable route in Lesson 5.1 instead.)
  2. (4 min) In an empty cell with room below it, write =SORT(UNIQUE(...)) on your category column to spill a clean, alphabetized list of categories.
  3. (5 min) Next to the first spilled category, add a SUMIFS that totals the amount for that category, referencing the spilled list with the # operator (e.g. E2#) so the totals line up and resize with it.
  4. (4 min) On another part of the sheet, build a FILTER that spills only the rows matching a condition you care about (one category, or amounts above a threshold). Include an if_empty message.
  5. (3 min) Make the filter interactive: put the condition value in its own cell and reference it, so changing that one cell re-filters the whole spilled view.
  6. (2 min) Test it live — add a new row of data and watch both the unique list and the filtered view grow by themselves. (A new row is only picked up if it falls inside the ranges your formulas use. The robust way is to build on an Excel Table from Lesson 3.1, e.g. =SORT(UNIQUE(tblData[Category])), so the source grows with every row. If you use a fixed range with empty rows at the bottom, UNIQUE will also list a 0 for the blanks.)
💡 Hint — starter formulas
Data assumed in A1:D50 — Code (A), Category (B), Date (C), Amount (D).

Sorted, unique list of categories (put in E2):
=SORT(UNIQUE(B2:B50))

Total per category, lined up beside the spilled list (in F2):
=SUMIFS($D$2:$D$50, $B$2:$B$50, E2#)

Live filtered view of one category typed into cell H1:
=FILTER(A2:D50, B2:B50=H1, "No matching rows")

Only high-value rows:
=FILTER(A2:D50, D2:D50>100, "None over 100")

Sorted, unique categories among only the paid orders — on a data
sheet that also has a Status column in E (so spill this one at G2,
clear of the data, not in E2):
=SORT(UNIQUE(FILTER(B2:B50, E2:E50="Paid")))

The E2# in the SUMIFS is the key trick: it means "every category in the spilled list," so the totals automatically match the list's length no matter how it grows.

✅ Project Completion Checklist

  • A SORT(UNIQUE(...)) formula spills a clean, ordered list of categories
  • A SUMIFS using the # reference shows a total beside each category
  • A FILTER spills a live view of matching rows, with an if_empty message
  • The filter reacts to a condition typed in its own cell
  • Adding or changing data updates every spilled result automatically

🎯 Quick Quiz

Question 1: Your =UNIQUE(B2:B50) formula shows #SPILL! instead of a list. What's the most likely cause?

Question 2: Which formula produces a clean, alphabetized list of the distinct categories in B2:B50?

Best Practices for Dynamic Arrays

✅ Do's

  • Give spills room to grow. Leave the cells below and beside an anchor formula empty so results can expand.
  • Use the # reference to point at a whole spilled range, so dependent formulas resize with it.
  • Feed dynamic arrays from Excel Tables (Lesson 3.1) so the source range grows automatically with new data.
  • Always give FILTER an if_empty value so a no-match result reads clearly instead of erroring.

❌ Don'ts

  • Don't type into spilled cells. Only the anchor cell is editable; the rest are owned by the formula.
  • Don't assume everyone has them. Older Excel shows #NAME? — offer a PivotTable or helper columns for those users.
  • Don't crowd the spill area with stray labels or merged cells, or you'll trigger #SPILL!.

💡 Pro Tips

  • Nest freely: SORT(UNIQUE(FILTER(...))) builds a filtered, de-duplicated, ordered list in one cell.
  • Point a chart at a spilled range (via the # reference) and the chart updates itself as the spill resizes.

📓 Learning Journal

Keep a learning journal as you work through this course — a separate document, a note, or even a second worksheet right in the workbook you're building. After each lesson, take a few minutes to write down:

  • Key concepts you learned
  • Techniques that clicked for you
  • Questions or confusion points to revisit
  • Ideas you want to try with your own data
  • Your progress and feelings about learning this — including where your confidence grew

✍️ This lesson's prompt: What manual, repetitive spreadsheet chore of yours could a single FILTER or SORT(UNIQUE(...)) replace? How does it feel to have one formula maintain a whole list for you? And are you on a version of Excel that has dynamic arrays — how did you check?

📝 Lesson Summary

🎓 Key Takeaways

  • A dynamic array formula returns many values that spill from the anchor cell into a self-sizing spill range — one formula, one living list.
  • Refer to a spill with the # spilled-range reference (e.g. E2#); a #SPILL! error means something is blocking the result cells.
  • FILTER returns rows matching a condition; SORT/SORTBY order results; UNIQUE drops duplicates; SEQUENCE generates number series.
  • They combine — SORT(UNIQUE(FILTER(...))) builds a filtered, de-duplicated, sorted list in a single cell that updates itself.
  • These need Microsoft 365 / Excel for the web (or Excel 2021+); older perpetual Excel lacks them and uses helper columns or PivotTables instead.

🎉 What You've Accomplished

You've reached the modern frontier of Excel formulas. You understand spilling, the # reference, and the #SPILL! error, and you can build live extracts and self-updating summaries with FILTER, SORT, and UNIQUE. Your tracker now carries a summary that maintains itself — no dragging, no refreshing. That completes Module 4's Formulas layer and sets you up perfectly for the Analysis stage.

❓ Common Questions at This Stage

These functions show #NAME? — what's wrong?

Your Excel version doesn't have dynamic arrays. They require Microsoft 365, Excel for the web, or Excel 2021/2024; versions like 2019 and earlier don't include them. Use a PivotTable (Lesson 5.1), Remove Duplicates, or helper columns for the same results on older Excel.

When should I use a dynamic array instead of a PivotTable?

Use dynamic arrays for a live, formula-driven summary that must stay current with no clicks — they update automatically. Use a PivotTable for exploratory analysis where you want to drag fields around and reshape the view interactively (and remember to refresh it). They're complementary, not rivals.

Can I delete or edit just one cell in a spilled range?

No — the whole spill is one formula owned by the anchor (top-left) cell. Edit or delete it there. If you need the values as fixed, standalone entries, copy the spill range and paste it as values, which breaks the link to the formula.

🔭 Looking Ahead

In the next lesson — Lesson 5.1: PivotTables — Summarize Anything in Seconds — we open Module 5, the Analysis stage. You'll meet the tool that summarizes thousands of rows with a few drags: the PivotTable. Having just built summaries by formula, you'll deeply appreciate what a PivotTable automates — and when each approach is the right call.

✅ Before the Next Lesson

  • Confirm your spilled summary and filtered view update when you add or change data
  • Try nesting: build one SORT(UNIQUE(FILTER(...))) formula and see it work
  • Write your Learning Journal entry for this lesson

📚 Additional Resources

🌟 Encouragement for the Journey

You just wrote formulas that build whole tables by themselves — the kind of thing that used to take experts a page of tricks. That's genuinely modern Excel, and you're fluent in it. Module 4 is complete: you can look up, reason, and spill. Next we let Excel summarize anything in seconds. Onward. 📊