How to Extract a List of Unique Values from a Column Range

This post explains that how to get the unique values from a range or column in excel. How to extract unique values from a list or excel range in excel 2013.

Extract unique values

If you want to extract a list of unique items from a column or range, you can use a combination of the IFERROR function, the INDEX function, the MATCH function and the COUNTIF function to create an array formula.

For example, to extract unique values from the range B2:B6, then display the unique values in column D, you can use the following array formula:

=IFERROR(INDEX($B$2:$B$6, MATCH(0, COUNTIF($D$1:D1,$B$2:$B$6),0)),"")

Note: when you enter the above array formula, you must hold the Control and Shift keys down, then press Enter. Then the formula bar should add curly braces surrounding the array formula.

Let’s see how this formula works:

= COUNTIF($D$1:D1,$B$2:$B$6)

The COUNTIF function counts the number of the unique values in the unique list (column D) appear in the range B2:B6. And the first range starts in the absolute reference of Cell D1. And the above formula need to enter in the Cell D2.  It returns an array like this:

{0;0;0;0;0}

When you drag the Fill Handle down to other cells, such as: D3, D4…. This formula return the following array result:

{1;0;0;0;1}

{1;1;0;1;0}

= MATCH(0, COUNTIF($D$1:D1,$B$2:$B$6),0))

The MATCH function returns the position of the first lookup value “0” in the array result returned by the COUNTIF function. The position number goes into the INDEX function as its row_num argument.

 

=INDEX($B$2:$B$6, MATCH(0, COUNTIF($D$1:D1,$B$2:$B$6),0))

The INDEX function extracts the value from range B2:B6 based on the position returned by the MATCH function. So it returns the first unique value in range B2:B6.

extract unique value from range 1

If you need to get the second or nth unique values in range B2:B6, then you just need to drag the Fill Handle to other cells.

 

=IFERROR()

If the INDEX function returns a #N/A error, and the IFERROR function will capture this excel error (#N/A!), then returns an alternate value.

extract unique value from range2


Related Formulas

  • Get the First Match in Two Excel Ranges
    If you want to find the first match between two excel ranges, you can use a combination of the INDEX function, the MATCH function and COUNTIF function to create a new formula….
  • Get Cell Address of a Lookup Value
    If you want to lookup a value in a range or column and return the cell address of the first match of lookup value, you can use a combination with the CELL function, the INDEX function and the MATCH function…
  • Find the nth Smallest Value
    You can use the SMALL function to get the 1st, 2nd, 3rd, or nth smallest value in an array or range. Also you can use the SMALL function within the INDEX function to extract the relative value of the same row…

Related Functions

  • Excel IFERROR function
    The Excel IFERROR function returns an alternate value you specify if a formula results in an error, or returns the result of the formula.The syntax of the IFERROR function is as below:= IFERROR (value, value_if_error)…
  • Excel COUNTIF function
    The Excel COUNTIF function will count the number of cells in a range that meet a given criteria. This function can be used to count the different kinds of cells with number, date, text values, blank, non-blanks, or containing specific characters.etc.= COUNTIF (range, criteria)…
  • Excel INDEX function
    The Excel INDEX function returns a value from a table based on the index (row number and column number)The INDEX function is a build-in function in Microsoft Excel and it is categorized as a Lookup and Reference Function.The syntax of the INDEX function is as below:= INDEX (array, row_num,[column_num])…
  • Excel MATCH function
    The Excel MATCH function search a value in an array and returns the position of that item.The syntax of the MATCH function is as below:= MATCH  (lookup_value, lookup_array, [match_type])….
Related Posts
VLOOKUP From Another Sheet Not Working
vlookup from another sheet not working3

In the previous post, you should know that how to fix or remove the #N/A error when using VLOOKUP formula to lookup value from another sheet. And this post will show you reasons why your VLOOKUP formula is not working ...

Case Sensitive Lookup with SUMPRODUCT and EXACT

Today, we will show you how to use SUMPRODUCT and EXACT to perform a case sensitive exact match. In this article, we provide a simple example to calculate bonus for employees whose names are case-sensitive. If you meet similar scenarios ...

Basic Usage of INDEX & MATCH – Case Sensitive Lookup

In Excel, INDEX function and MATCH function are often used together for retrieving data from a particular position. MATCH function is one of Excel lookup & reference functions that can perform approximate match or exact match by setting different match ...

Basic Rates Calculation by VLOOKUP Based on Weight Band

Microsoft Excel provides many functions that can execute logical test, search data, return current date and something else. They are very useful in daily work. And Excel VLOOKUP function is one of Excel most frequently used functions. It belongs to ...

Basic Grade Calculation by VLOOKUP Function – Approximate Match

In Excel, except combination INDEX+MATCH, we can also apply other functions to search data, for example VLOOKUP function. Like MATCH function, VLOOKUP function is one of Excel lookup & reference functions that can perform approximate match or exact match by ...

Basic Discount Calculation with VLOOKUP Function

In Excel, except combination INDEX+MATCH, we can also apply other functions to search data, for example VLOOKUP function. Like MATCH function, VLOOKUP function is one of Excel lookup & reference functions that can perform approximate match or exact match by ...

Basic Usage of INDEX & MATCH – Exact Match
Basic Usage of INDEX & MATCH - Exact Match 1&2

In Excel, INDEX function and MATCH function are often used together for returning value or cell reference or range reference from specified position. And MATCH function is one of Excel lookup & reference functions that can perform approximate match or ...

Basic Usage of INDEX & MATCH – Approximate Match

In Excel, INDEX function and MATCH function are often used together for returning value or cell reference or range reference from specified position. And MATCH function is one of Excel lookup & reference functions that can perform approximate match by ...

Approximate Match with Multiple Criteria by INDEX & MATCH
Approximate Match with Multiple Criteria by INDEX & MATCH 1 & 2

In Excel, INDEX function and MATCH function are often used together for returning data from specific position. And MATCH function is one of Excel lookup & reference functions that can return approximate value by setting match type. Above all, through ...

How to Count Cells Not Equal to One of Many Things in Excel
count cells not equal many things10

This post will guide you how to count the number of cells that are not equal to many things in a given range cells using a formula in Excel 2013/2016. You can easily to count cells not equal to a ...

Sidebar