Tip: Other languages are Google-Translated. You can visit the English version of this link.
Log in
x
or
x
x
Register
x

or

How to count unique values or numbers in a column in Excel?

Assuming you have a list of values in a range of the worksheet, and now you want to know how many unique values are there. If you identify and count them one by one, it will waste a lot of times. So here I will introduce you some quick tricks to deal with this problem.

Count the number of unique values with Formulas

Count the number of unique values with Advanced Filter

Count the number of unique values with Kutools for Excel


Select / highlight duplicate or unique values at once:

With Kutools for Excel’s Select Duplicate & Unique Cells, you can quickly select or highlight the duplicate values or the unique values in range as you need.

doc select unique-1-1

Kutools for Excel: with more than 200 handy Excel add-ins, free to try with no limitation in 60 days. Download and free trial Now!


Count the number of unique values with Formulas

There are some formulas can help you to quickly count the number of unique values in a range. If your data are numbers, for example, you have a column of numbers in range (A1:A10), see screenshot:

doc-count-unique-values1

You can use the following formulas, please do as this:

1. Enter this formula =SUMPRODUCT(1/COUNTIF(A1:A10,A1:A10)) into a blank cell.

doc-count-unique-values1

2. Then press Enter key, and the number of the unique value will be displayed. See screenshot:

doc-count-unique-values1

Tips: 1. Here is another formula =SUM(IF(FREQUENCY(A1:A10, A1:A10)>0,1)) also can help you. Please apply anyone as you like. Both of the above formulas will count the unique values including the first duplicate as well.

2. If there are a range of text in your worksheet, the above formulas will not work, you should use this array formula: =SUM(IF(FREQUENCY(IF(LEN(A1:A10)>0,MATCH(A1:A10,A1:A10,0),""), IF(LEN(A1:A10)>0,MATCH(A1:A10,A1:A10,0),""))>0,1))

doc-count-unique-values1

After enter the formula, then remember to press Shift + Ctrl + Enter keys, and the number of unique values has been displayed.

doc-count-unique-values1

Notes:

  • 1. The range A1:A10 in the above formulas are variable, you can change them as you need.
  • 2. This formula also count the unique values including the first duplicate.
  • 3. This formula works in a range of text and numbers as well.

Count the number of unique values with Advanced Filter

You can also use the Advanced Filter to extract the unique values from a column of data and paste them to a new location. Then with the ROWS function to count the number of unique values in the new range. The specific steps are as follows:

1. Click Data tab in the ribbon, and then click Advanced command, see screenshot:

doc-count-unique-values1

2. And in the Advanced Filter dialog box:

doc-count-unique-values1
  • (1.) Select Copy to another location option under Action;
  • (2.) In the List range section, click doc-button1 button to select the range data that you want to use;
  • (3.) In the Copy to section, click doc-button1 button to specify a cell that you want to put the filtered unique values into;
  • (4.) At last, check Unique records only option.

3. After finishing the settings, click OK, the unique values have been listed in a new column, see screenshot:

doc-count-unique-values1

4. Then in a blank cell, enter the short formula =ROWS(E1:E8),and press Enter key on the keyboard. And the number of the unique values will be displayed.

doc-count-unique-values9 -2 doc-count-unique-values10

Count the number of unique values with Kutools for Excel

 Here, I will recommend you a useful tool- Kutools for Excel, with its Select Duplicate & Unique Cells function, you can quickly select the duplicate values or unique values and count the number of them.

Kutools for Excel : with more than 300 handy Excel add-ins, free to try with no limitation in 60 days

After installing Kutools for Excel, please do with the following steps:

1. Select the data range that you want to count the unique values.

2. Then click Kutools > Select > Select Duplicate & Unique Cells, see screenshot:

doc-count-unique-values11-11

3. In the Select Duplicate & Unique Cells dialog box, choose Unique values only or All unique (Including 1st duplicates) as you want, at same time, you can also highlight the unique values by checking Fill backcolor or Fill font color under the Processing of results section, see screenshot:

doc-count-unique-values12-12

4. (1.) If you choose Unique values only, only the unique values will be counted and selected at once. See screenshot:

doc-count-unique-values13-13

(2.) If you choose All unique (Including 1st duplicates), all unique values which including the first duplicates will be counted and selected as following screenshot shown:

doc-count-unique-values14-14

Click to know more about this Select Duplicate & Unique Cells feature.

Download and free trial Kutools for Excel Now !


Demo: Count the number of unique values with Kutools for Excel

Kutools for Excel: with more than 200 handy Excel add-ins, free to try with no limitation in 60 days. Download and free trial Now!


Related article:

How to filter or select unique records from selected range in Excel?


Recommended Productivity Tools

Ribbon of Excel (with Kutools for Excel installed)

300+ Advanced Features Increase Your Productivity by 71%, and Help You To Stand Out From Crowd!

Would you like to complete your daily work quickly and perfectly? Kutools For Excel brings 300+ cool and powerful advanced features (Combine workbooks, sum by color, split cell contents, convert date, and so on...) for 1500+ work scenarios, helps you solve 82% Excel problems.

  •  Deal with all complicated tasks in seconds, help to enhance your work ability, get success from the fierce competition, and never worry about being fired.
  •  Save a lot of work time, leave much time for you to love and care the family and enjoy a comfortable life now.
  •  Reduce thousands of keyboard and mouse clicks every day, relieve your tired eyes and hands, and give you a healthy body.
  •  Become an Excel expert in 3 minutes, and get admiring glance from your colleagues or friends.
  •  No longer need to remember any painful formulas and VBA codes, have a relaxing and pleasant mind, give you a thrill you've never had before.
  •  Spend only $39, but worth than $4000 training of others. Being used by 110,000 elites and 300+ well-known companies.
  •  60-day unlimited free trial. 60-day money back guarantee. Free upgrade and support for 2 years. Buy once, use forever.
  •  Change the way you work now, and give you a better life immediately!

Office Tab Brings Efficient And Handy Tabs to Office (include Excel), Just Like Chrome, Firefox, And New IE

  • Increases your productivity by 50% when viewing and editing multiple documents.
  • Reduce hundreds of mouse clicks for you every day, say goodbye to mouse hand.
  • Open and create documents in new tabs of same window, rather than in new windows.
  • Help you work faster and easily stand out from the crowd! One second to switch between dozens of open documents!
Say something here...
symbols left.
You are guest ( Sign Up? )
or post as a guest, but your post won't be published automatically.
Loading comment... The comment will be refreshed after 00:00.
  • To post as a guest, your comment is unpublished.
    priya · 2 years ago
    tying to know the values of unique customer for different products, for ex: there are 100 customers, wanted to know out of those how many are unique customers who buy only those products.

    Likewise: total sales of products = 100
    apple = 40
    orange = 60

    how to find out customers who have brought only oranges and apples?
  • To post as a guest, your comment is unpublished.
    Alireza · 3 years ago
    in this formula,
    =SUM(IF(FREQUENCY(MATCH(B2:B10,B2:B10,0),MATCH(B2:B10,B2:B10,0))>0,1))
    can i add another "if"? for example i want count the range of unique text in B2:B150 if C2:C150=1 ???
    can i?
  • To post as a guest, your comment is unpublished.
    Meags · 3 years ago
    How would you seperate unique values in a cell? ie. #2,#2,#3 I only want the #2 to appear once?
  • To post as a guest, your comment is unpublished.
    Saurabh · 3 years ago
    no these formulas are not sufficient, in actual my problem is little bit big, there are lots of column in my sheet, with the name of store id and store name and months in three column respectively and there is repetition of store name in every month a no of time, i have to calculate the unique no of the store name with respect to month. please suggest me the exact formula accordingly.
  • To post as a guest, your comment is unpublished.
    Wendy · 3 years ago
    Order Rep Status Product Order Value
    A1 John Close Apple $1
    A1 John Close Pear $1.50
    A2 John Open Orange $0.50
    A3 John Close Grape $3.00
    A2 John Open Apple $1
    A4 John Close Orange $0.50
    A5 Mary Close Apple $1
    A6 Peter Close Grape $3.00

    Appreciate your advice on this...
    I am trying to count the unique number of order # (first column), where the rep is John and the order status is closed.
    the result to achieve is 3 unique orders (A1, A3 and A4). But if i do a countifs function, it literally count the number of 'Close' where rep=John, and that comes back with 4.


    Is this possible to count unique values against multiple conditions of other columns?