How to Use the Excel UNIQUE Function to Extract Distinct Values from a List

The Tedium of Deduplication

In almost every data analysis workflow, you will encounter columns filled with repetitive data. A list of 5,000 sales transactions might only contain 12 distinct product names. A database of 10,000 employees might only span 4 distinct departments.

When you need to create a summary report, build a dropdown menu, or chart the performance of those departments, your first step is always the same: you must extract a clean list of the unique values from that massive column.

Historically, Excel users had to rely on the “Remove Duplicates” button on the Data ribbon. While effective, this is a destructive, manual process. It deletes data, and worse, it is static. If a new transaction comes in tomorrow featuring a brand new 13th product, your extracted list will not update.

With the introduction of Dynamic Arrays, Microsoft released a game-changing function that performs this extraction automatically, safely, and dynamically: UNIQUE.

Step 1: The Basic Extraction

The UNIQUE function looks at a range of cells, identifies the distinct items, and “spills” the results down the column automatically.

The basic syntax is incredibly simple:
=UNIQUE(array, [by_col], [exactly_once])

Imagine you have a list of City names in cells A2:A5000. Many cities are repeated hundreds of times.

Click on an empty cell where you want your clean list to start (e.g., cell D2).

Type the formula:
=UNIQUE(A2:A5000)

Press Enter. Instantly, Excel will generate a clean, deduplicated list of cities spilling downward from D2. If someone types a new city into cell A5000 tomorrow, that city will automatically appear at the bottom of your unique list in column D.

Step 2: Sorting the Output

By default, UNIQUE extracts the values in the exact order it discovers them in the source data. This often results in a messy, disorganized list.

Because Dynamic Arrays are designed to nest inside one another, you can wrap the UNIQUE function inside a SORT function to instantly alphabetize the output.

Modify your formula in D2 to look like this:
=SORT(UNIQUE(A2:A5000))

Now, your extracted list of cities is perfectly deduplicated and perfectly alphabetized from A to Z, requiring zero manual clicks.

Step 3: Extracting Unique Rows (Multiple Columns)

The UNIQUE function isn’t limited to a single column. It can analyze entire rows to find unique combinations of data.

Let’s say Column A is First Name and Column B is Last Name. If you have a massive employee list (A2:B1000), you might have five people named “John” and four people with the last name “Smith”.

If you run =UNIQUE(A2:B1000), Excel looks at the combination of the two columns. It will keep “John Smith” and “John Doe” because the row as a whole is unique. It will only remove a row if both the first and last names are identical to a previous row.

The function will spill out two columns wide and as many rows deep as necessary to display the unique combinations.

Step 4: Finding the Odd Ones Out (Exactly Once)

The third, often-ignored argument of the UNIQUE function is [exactly_once]. This is a boolean (TRUE or FALSE) flag that completely changes the behavior of the formula.

Normally, UNIQUE means “give me one copy of every distinct item.”

However, if you set this third argument to TRUE, it means “only give me the items that appear in the source list exactly one time.”

Imagine you are reviewing an invoice ledger. Every invoice number should appear exactly twice (once when the bill is issued, and once when the payment clears). If an invoice number appears only once, it means the bill hasn’t been paid.

If your invoice numbers are in C2:C500, you can find the unpaid bills by typing:

=UNIQUE(C2:C500, FALSE, TRUE)

(Note: The middle FALSE tells Excel to look down rows, which is standard. The final TRUE activates the “exactly once” mode).

This formula will filter out any invoice number that appears 2, 3, or 4 times, outputting only the stragglers that appear a single time, turning UNIQUE into a powerful auditing tool.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.