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?


Kutools for Excel Solves Most of Your Problems, and Increases Your Productivity by 80%

  • Reuse: Quickly insert complex formulas, charts and anything that you have used before; Encrypt Cells with password; Create Mailing List and send emails...
  • Super Formula Bar (easily edit multiple lines of text and formula); Reading Layout (easily read and edit large numbers of cells); Paste to Filtered Range...
  • Merge Cells/Rows/Columns without losing Data; Split Cells Content; Combine Duplicate Rows/Columns... Prevent Duplicate Cells; Compare Ranges...
  • Select Duplicate or Unique Rows; Select Blank Rows (all cells are empty); Super Find and Fuzzy Find in Many Workbooks; Random Select...
  • Exact Copy Multiple Cells without changing formula reference; Auto Create References to Multiple Sheets; Insert Bullets, Check Boxes and more...
  • Extract Text, Add Text, Remove by Position, Remove Space; Create and Print Paging Subtotals; Convert Between Cells Content and Comments...
  • Super Filter (save and apply filter schemes to other sheets); Advanced Sort by month/week/day, frequency and more; Special Filter by bold, italic...
  • Combine Workbooks and WorkSheets; Merge Tables based on key columns; Split Data into Multiple Sheets; Batch Convert xls, xlsx and PDF...
  • More than 300 powerful features. Supports Office/Excel 2007-2019 and 365. Supports all languages. Easy deploying in your enterprise or organization. Full features 30-day free trial.
kte tab 201905

Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier

  • Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
  • Open and create multiple documents in new tabs of the same window, rather than in new windows.
  • Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!
officetab bottom
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 · 3 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 · 4 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 · 4 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 · 4 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?
  • To post as a guest, your comment is unpublished.
    Snoo · 4 years ago
    Anyone know how to make the =SUM(IF(FREQUENCY(A1:A10, A1:A10)>0,1)) formula work to count the number of unique fields for a series of intervals?
    For example, I want to be able to find out the number of unique entries for each day. My data is structures as ID numbers in Column A, Dates in column B. The data is sorted by the date column.

    Any help would be very very much appreciated!
  • To post as a guest, your comment is unpublished.
    John Murray · 4 years ago
    Your formula works a treat and allows me to see the number of unique clients that I have in total (i.e. from all my sales people combined). I am struggling however, to update the formula so that it would allow me to see the number of unique clients an individual sales person would have. Any ideas?
  • To post as a guest, your comment is unpublished.
    Afhar Siyam · 4 years ago
    =SUMPRODUCT(1/COUNTIF(A1:A10,A1:A10))when you are selecting the range make sure that the cells should not be blank.
  • To post as a guest, your comment is unpublished.
    Sam · 4 years ago
    Hi,

    Thank you for your help regarding the duplicates but I'd like to modify your formula =SUM(IF(FREQUENCY(A2:A800, A2:A800)>0,1)) and add this condition (assuming that all the cells are numbers) to count only between 402 to 460 and it goes on to 502 to 560; 602 to 660 (1 formula per range) would it be possible?

    Thank you very much!
  • To post as a guest, your comment is unpublished.
    Christopher · 5 years ago
    This is awesome. Follow-up question: how would you subtotal this if filters were applied?

    If I have:
    Apple
    Orange
    Grape
    Apple

    And filter out the range so only Apple is displayed, how would I get the total to display: "1"?

    Thanks!
    --
    Christopher
  • To post as a guest, your comment is unpublished.
    Jeswant Alexander · 5 years ago
    Your solution with SUMPRODUCT(1/COUNTIF(A1:A10,A1:A10)) is awesome and save a lot of time. Can you please explain the logic as how it works. I'm very interested.
  • To post as a guest, your comment is unpublished.
    Jeswant Alexander · 5 years ago
    Your solution with =SUMPRODUCT(1/COUNTIF(A1:A10,A1:A10)) is awesome and save a lot of time. To some extent I understand sumproduct and countif, but unable to catchup the logic has how this solution works. Can you please explain.
  • To post as a guest, your comment is unpublished.
    Jeswant Alexander · 5 years ago
    The solution with =SUMPRODUCT(1/COUNTIF(A1:A10,A1:A10)) is awesome and saves a lot of time. I understand sumproduct and countif to an extent but unable to catchup the logic as how your solution formula works. Can you please explain me the logic.
  • To post as a guest, your comment is unpublished.
    Amit · 5 years ago
    To actually find the frequency distribution (no of repetition of unique values with in a range), You can use countif funcion. To the cell adjacent to the unique records found out from the original data range, just use funtion:
    = countif(Original Range, unique value)
    This will list out the frequency distributions!!!

    Cheers!
  • To post as a guest, your comment is unpublished.
    naveen · 5 years ago
    super boss... my friends wasted 2 hrs in searchig....u saved my time:-)
  • To post as a guest, your comment is unpublished.
    Fábio Makoto Kawanam · 5 years ago
    [b]Works fine, Thanks a lot![/b]
    :lol:
  • To post as a guest, your comment is unpublished.
    brian moffatt · 5 years ago
    Awesome, I tried many formulas and nothing worked. This worked on the first attempt, just changed teh cell range.
    Thanks! :roll: