← Learning Hub
Intermediate

Dynamic Arrays: UNIQUE, SORT, FILTER and SEQUENCE

In Excel 365 and Excel 2021+, one formula can return many results. They "spill" into the cells below and to the right. These functions replace a lot of manual work.

Traditionally, one formula gave one answer in one cell. Dynamic arrays let one formula return a whole list or table that "spills" into neighbouring cells and resizes itself when the data changes. Tasks that used to need copying formulas, helper columns or pivot tables - a sorted list, the unique customers, a filtered report - are now a single formula.

Example
     A          B         C        D
1    Date       Region    Product  Amount
2    01-11-26   North     Pen        200
3    01-11-26   South     Bag        900
4    02-11-26   North     Bag       1800
5    03-11-26   East      Pen        400
6    03-11-26   South     Book       300
Example
=UNIQUE(B2:B6)                          → North, South, East (one each)
=SORT(D2:D6, , -1)                      → 1800, 900, 400, 300, 200 (largest first)
=SORTBY(C2:C6, D2:D6, -1)               → products ordered by amount
=FILTER(A2:D6, B2:B6="North")           → the two North rows, all 4 columns
=FILTER(A2:D6, (B2:B6="South")*(D2:D6>500), "None")   → AND: South and over 500
=FILTER(A2:D6, (C2:C6="Pen")+(C2:C6="Book"))          → OR: Pen or Book
=SEQUENCE(5)                            → 1, 2, 3, 4, 5

Combine them

Example
=SORT(UNIQUE(C2:C6))                    → Bag, Book, Pen (unique and sorted)
=COUNTA(UNIQUE(B2:B6))                  → 3 regions
=TAKE(SORT(A2:D6, 4, -1), 3)            → the top 3 sales rows

A live summary table

  • In F2: =UNIQUE(B2:B6) - the regions spill down.
  • In G2: =SUMIFS(D2:D6, B2:B6, F2#) - the # means "the whole spilled list", so totals spill too.
  • Add a new region to the data and both columns grow by themselves.
If you see #SPILL!, something is in the way of the results. Clear the cells below the formula.
Key points
  • UNIQUE, SORT, SORTBY, FILTER and SEQUENCE return many results.
  • Results spill; refer to them with # (e.g. F2#).
  • #SPILL! means something is blocking the results.

📝 Test yourself

1. What does =UNIQUE(B2:B6) return?
2. In FILTER, how do you combine two rules with AND?
3. Fill in the symbol that refers to a whole spilled range starting in F2:
=SUM(F2)