Lists that spill · About 6 minutes
Practice with lists that spill
Each task here needs a list, but not the same function every time. Ask what the list should do: drop repeats (UNIQUE), keep some rows (FILTER), or put them in order (SORT or SORTBY).
Some tasks need two at once. Put one inside the other: =SORT( drops the repeats, then sorts what's left.
These work in Excel 365 and Excel 2021 or later. Google Sheets has all of them except SORTBY. Excel 2016 and 2019 don't have them.
Part of Plus
Free during our founding launch: sign in to unlock this lesson's exercises, the timed practice sets and the rest of Plus. The free lessons stay free, with no account needed.
What this practice covers
This practice mixes the list functions, so each task asks you to choose. Should the list drop repeats, keep only some rows, or come out in order? Some tasks need two of these at once.
Every answer spills: one formula in one cell fills the cells below it. Leave room for the list, and read the task twice before choosing the function.
The formulas you'll use
=UNIQUE(
- array
- The list to take each value from once.
=FILTER(
- include
- The test each row must pass. Join two tests with
*for both or+for either.
=SORT(
- sort_order
- 1 for A to Z or lowest first, -1 for highest first. In Google Sheets use TRUE or FALSE.
=SORTBY(
- by_array1
- The cells that decide the order, which don't have to be shown.
A worked example
In D2, list the names of the people on the Day shift, A to Z.
| A | B | C | D | |
|---|---|---|---|---|
| 1 | Name | Shift | Hours | Day, A-Z |
| 2 | Wen | Day | 6 | Dev |
| 3 | Abel | Night | 8 | Pia |
| 4 | Pia | Day | 4 | Wen |
| 5 | Dev | Day | 7 | |
| 6 | Lin | Night | 5 |
=SORT( FILTER( A2:A6, B2:B6="Day"))First keep the names in A2 to A6 whose shift is Day, then sort them A to Z: Dev, Pia and Wen spill into D2 to D4.Mistakes to watch for
The list has repeats
FILTER and SORT keep every matching row. Wrap the list in UNIQUE when each value should appear once.
SORT inside FILTER shows an error
Sort the filtered list, not the other way round, so the test and the list keep the same rows: SORT goes on the outside.
A #SPILL! error instead of a list
A cell where the list needs to land isn't empty. Clear it so the whole list fits.
Which list function?
Drop repeats: UNIQUE. Keep some rows: FILTER. Put them in order: SORT, or SORTBY to order by a column you don't show. To do two jobs, put one formula inside the other, and the outer one works on what the inner one gives back.
These work in Microsoft 365, Excel 2021 or later and Google Sheets, except SORTBY, which Google Sheets doesn't have. Excel 2016 and 2019 show #NAME? for all of them.
Questions people ask
How do I get a sorted list of unique values?
Put one inside the other: =SORT( drops the repeats, then sorts what's left.
How do I choose between UNIQUE, FILTER and SORT?
Drop repeats: UNIQUE. Keep some rows: FILTER. Put them in order: SORT or SORTBY.
Do these work in older Excel?
No. They need Excel 365 or Excel 2021 or later. Google Sheets has all of them except SORTBY.