ExcelReady
CourseMock testsFunction guidesBlog
Start freeStart learning for free
ExcelReady

Be Excel-ready before day one. Hands-on practice in your browser, with instant feedback.

Learn

  • Course
  • Mock tests
  • Function guides
  • Blog

Test prep

  • Excel level test
  • Excel test practice
  • Free screening quiz
  • Certificate

Company

  • Editorial policy
  • Contact
  • Terms
  • Privacy

© 2026 ExcelReady. All rights reserved.

  1. Blog
  2. Dynamic arrays
  3. Make a Sorted List of Unique Values in Excel

Make a Sorted List of Unique Values in Excel

By ExcelReady Team·Updated November 1, 2026·6 min read

The short answer

To make a unique sorted list in Excel, wrap UNIQUE inside SORT: =SORT(UNIQUE(B2:B9)). UNIQUE removes the repeats and SORT puts what is left in A to Z order. The list spills down and updates when the data changes. Use =SORT(UNIQUE(B2:B9),,-1) for Z to A. Both functions need Excel 2021, Excel 2024 or Microsoft 365.

Key takeaways

  • =SORT(UNIQUE(range)) returns each value once, in A to Z order, and updates by itself.
  • Add -1 as SORT's third argument for Z to A: =SORT(UNIQUE(range),,-1).
  • Blank cells show up as 0 in the list; wrap the range in FILTER to drop them.
  • Refer to the whole list with the # sign, like E2#, to count or total each item beside it.
  • In Excel 2019 or older, use Remove Duplicates or Advanced Filter, then sort A to Z.
On this page+
  1. The formula for a unique sorted list
  2. How to build the list step by step
  3. How to sort the unique list Z to A or by count
  4. How to skip blanks in a unique list
  5. How to add counts or totals next to the list
  6. How to make a unique sorted list in older Excel
  7. Practise it

To make a unique sorted list in Excel, type =SORT(UNIQUE(B2:B9)) in an empty cell. UNIQUE keeps each value once, SORT puts the values in A to Z order, and the list updates by itself when the data changes. This guide is for anyone who needs a clean list of customers, products or regions for a summary table, a drop-down or a test question.

The formula for a unique sorted list#

The formula has two functions, one inside the other. Excel works from the inside out:

Excel formula
=SORT(UNIQUE(B2:B9))
  1. UNIQUE(B2:B9) looks down the range and returns each value once, in the order it first appears.
  2. SORT(...) takes that shorter list and sorts it A to Z (or smallest to largest for numbers).

The result spills: it fills as many cells below as it needs. You type the formula in one cell only. Both functions need Excel 2021, Excel 2024 or Microsoft 365. In older versions you see #NAME?.

All the examples use this order list in A1:C9:

ABC
1OrderProductQty
21001Pens12
31002Stapler2
41003Folders30
51004Pens8
61005Tape5
71006Folders10
81007Pens20
91008Binders4

How to build the list step by step#

Pick an empty cell with empty cells below it, type the formula and press Enter. Here it goes in E2:

  1. Click E2.
  2. Type =SORT(UNIQUE( and select B2:B9. Leave out the header in B1.
  3. Type )) to close both functions and press Enter.
UNIQUE aloneSORT(UNIQUE(...))
PensBinders
StaplerFolders
FoldersPens
TapeStapler
BindersTape

Eight rows became five. If you add order 1009 for "Labels" and extend the range, Labels appears between Folders and Pens on its own. The UNIQUE function guide and the SORT function guide list every optional argument. For a full introduction to UNIQUE, see how the UNIQUE function works.

How to sort the unique list Z to A or by count#

SORT takes up to four arguments: =SORT(array, sort_index, sort_order, by_col). To sort Z to A, set sort_order to -1 and leave sort_index empty:

Excel formula
=SORT(UNIQUE(B2:B9),,-1)

The result is Tape, Stapler, Pens, Folders, Binders. The two commas skip sort_index, which then defaults to 1 (the first column).

To put the most common item first, sort by how many times each one appears. SORTBY can sort one list by another:

Excel formula
=SORTBY(UNIQUE(B2:B9),COUNTIF(B2:B9,UNIQUE(B2:B9)),-1)

COUNTIF counts each unique product in the original column: Pens 3, Folders 2 and 1 for the rest. SORTBY then orders the products by those counts, highest first. So Pens comes first, then Folders, then the three products ordered once. For a ranked list of the biggest values instead, read about the top N list with SORT and FILTER.

How to skip blanks in a unique list#

Blank cells in the range appear as a 0 in the result, and SORT puts that 0 at the top. Remove blanks with FILTER before UNIQUE sees them:

Excel formula
=SORT(UNIQUE(FILTER(B2:B20,B2:B20<>"")))

FILTER keeps only the cells that are not empty (<>"" means "not equal to nothing"). This is useful when you point the formula at a longer range, like B2:B20, to leave room for new rows.

Extra spaces cause a similar problem. "Pens" and "Pens " with a trailing space are two different values to UNIQUE. Clean them inside the formula with TRIM: =SORT(UNIQUE(TRIM(B2:B9))). UNIQUE is not case-sensitive, so "pens" and "Pens" already count as one.

How to add counts or totals next to the list#

Once the list is in E2, you can refer to the whole spilled list as E2#. The # is the spill range operator: it means "every cell this formula filled", even when the list grows. In F2, type:

Excel formula
=COUNTIF(B2:B9,E2#)

This spills a count beside each product: Binders 1, Folders 2, Pens 3, Stapler 1, Tape 1. For total quantity, use SUMIF in G2:

Excel formula
=SUMIF(B2:B9,E2#,C2:C9)

That gives Binders 4, Folders 40, Pens 40, Stapler 2, Tape 5. You now have a small summary table that updates with the data. To count how many distinct products there are, use =COUNTA(E2#), which returns 5. The article on counting unique values covers more ways to do that, including older versions.

A sorted unique list also makes a great source for a drop-down. See dynamic drop-down lists that update themselves.

How to make a unique sorted list in older Excel#

Excel 2019 and older don't have UNIQUE or SORT, so you build the list with menu commands. The result is a fixed list that doesn't update.

With Remove Duplicates#

  1. Copy the Product column to an empty column.
  2. With the copy selected, go to Data > Remove Duplicates and click OK.
  3. With the list still selected, go to Data > Sort A to Z.

With Advanced Filter#

  1. Click inside the data and go to Data > Advanced (in the Sort & Filter group).
  2. Choose Copy to another location, set the List range to B1:B9 and Copy to an empty cell.
  3. Tick Unique records only and click OK, then sort the new list A to Z.

Advanced Filter leaves your original data untouched. Remove Duplicates deletes rows from whatever you select, so always run it on a copy. The comparison of UNIQUE vs Remove Duplicates explains when each is the better choice.

Practise it#

A sorted list of distinct values is the first step of many summary tasks in job tests. Practise the UNIQUE function in a live spreadsheet: you type the formula and it checks it instantly. Then practise sorting with the SORT function and combine the two. Try the exercise on this page first: one formula, five products.

Try it yourself

This is a live spreadsheet. Type the formula in the green cell and press Enter.

Your manager wants an alphabetical list of the products that were ordered. In E2, combine SORT and UNIQUE on B2:B9, then press Enter.

fx
ABCDEF
1
Order
Product
Qty
Products A-Z
2
1001
Pens
12
3
1002
Stapler
2
4
1003
Folders
30
5
1004
Pens
8
6
1005
Tape
5
7
1006
Folders
10
8
1007
Pens
20
9
1008
Binders
4
10
11
12

Tip: UNIQUE goes on the inside to remove repeats. SORT goes on the outside to put them in order.

Practise this in a lesson

LessonUNIQUE: list and count distinct valuesPull a clean list of distinct regions or customers with UNIQUE, then count them with COUNTA.LessonSORT: order data with a formulaSort a table by any column, ascending or descending, and combine SORT with FILTER and UNIQUE.Function guideUNIQUEList distinct values with Excel's UNIQUE, count them with COUNTA, or find items that appear only once. Examples plus a live exercise.Function guideSORTSort a range with a formula using Excel's SORT. Sort by any column, highest first, or combined with FILTER. Includes a live exercise.

Frequently asked questions

How do I get a list of unique values in alphabetical order in Excel?

+

Use =SORT(UNIQUE(range)), for example =SORT(UNIQUE(B2:B9)). It returns every distinct value once, sorted A to Z, and spills down from the cell you type it in.

How do I sort a unique list in descending order?

+

Give SORT a sort order of -1 and leave the second argument empty: =SORT(UNIQUE(B2:B9),,-1). The two commas skip the sort index, which defaults to the first column.

Why is there a 0 in my unique list?

+

Your range includes an empty cell, and UNIQUE returns it as 0. Filter the blanks out first: =SORT(UNIQUE(FILTER(B2:B20,B2:B20<>""))).

How do I make a sorted unique list without the UNIQUE function?

+

Copy the column to a new place, use Data > Remove Duplicates, then sort it A to Z. Advanced Filter with Unique records only also works and keeps the original data unchanged.

Is UNIQUE case-sensitive?

+

No. UNIQUE treats pens, Pens and PENS as the same value and keeps the first one it finds. Extra spaces do count, so "Pens " with a trailing space is a separate item.

Sources

  • UNIQUE function - Microsoft Support
  • SORT function - Microsoft Support

Written and checked by the ExcelReady Team. First published November 1, 2026. The practice exercise runs in the same formula engine as our lessons. Found a mistake? Read our editorial policy or email hello@excelready.app.

On this page

  1. The formula for a unique sorted list
  2. How to build the list step by step
  3. How to sort the unique list Z to A or by count
  4. How to skip blanks in a unique list
  5. How to add counts or totals next to the list
  6. How to make a unique sorted list in older Excel
  7. Practise it

Keep reading

Dynamic arrays· 5 min read

Dynamic Drop-Down Lists in Excel That Update Themselves

A dynamic drop-down list in Excel updates itself when the source data changes. The simplest way is to keep the items in an Excel table and use the table column as the Data Validation source. In Microsoft 365 or Excel 2021, build the items with =SORT(UNIQUE(A2:A50)) in a helper cell such as F2, then set the source to =$F$2#.

Dynamic arrays· 6 min read

Make a Top 5 List With SORT and FILTER

To make a top 5 list with a formula, keep the rows whose value is at least the 5th largest, then sort them: =SORT(FILTER(A2:C9,C2:C9>=LARGE(C2:C9,5)),3,-1). Change 5 to 10 for a top 10 list. It spills the whole rows, largest first, and includes ties. It needs Excel 2021, Excel 2024 or Microsoft 365.

Dynamic arrays· 7 min read

The UNIQUE Function in Excel

The UNIQUE function returns each different value in a range once, in the order it first appears: =UNIQUE(C2:C9). Type it in one cell and the results spill into the cells below. Wrap it in COUNTA to count distinct values, or in SORT to put them in order. UNIQUE needs Excel 2021, Excel 2024 or Microsoft 365.

Don't just read about Excel. Do it.

Practise real formulas in a live spreadsheet with instant feedback, right in your browser. Nothing to download.

Start learning for free