Skip to main content

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


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 30 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 300 handy Excel add-ins, free to try with no limitation in 30 days. Download and free trial Now!


Related article:

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

Best Office Productivity Tools

Popular Features: Find, Highlight or Identify Duplicates   |  Delete Blank Rows   |  Combine Columns or Cells without Losing Data   |   Round without Formula ...
Super Lookup: Multiple Criteria VLookup    Multiple Value VLookup  |   VLookup Across Multiple Sheets   |   Fuzzy Lookup ....
Advanced Drop-down List: Quickly Create Drop Down List   |  Dependent Drop Down List   |  Multi-select Drop Down List ....
Column Manager: Add a Specific Number of Columns  |  Move Columns  |  Toggle Visibility Status of Hidden Columns  |  Compare Ranges & Columns ...
Featured Features: Grid Focus   |  Design View   |   Big Formula Bar    Workbook & Sheet Manager   |  Resource Library (Auto Text)   |  Date Picker   |  Combine Worksheets   |  Encrypt/Decrypt Cells    Send Emails by List   |  Super Filter   |   Special Filter (filter bold/italic/strikethrough...) ...
Top 15 Toolsets12 Text Tools (Add Text, Remove Characters, ...)   |   50+ Chart Types (Gantt Chart, ...)   |   40+ Practical Formulas (Calculate age based on birthday, ...)   |   19 Insertion Tools (Insert QR Code, Insert Picture from Path, ...)   |   12 Conversion Tools (Numbers to Words, Currency Conversion, ...)   |   7 Merge & Split Tools (Advanced Combine Rows, Split Cells, ...)   |   ... and more

Supercharge Your Excel Skills with Kutools for Excel, and Experience Efficiency Like Never Before. Kutools for Excel Offers Over 300 Advanced Features to Boost Productivity and Save Time.  Click Here to Get The Feature You Need The Most...

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!
Comments (18)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
With the new UNIQUE function in Excel 365: COUNTA(UNIQUE(interval)).
This comment was minimized by the moderator on the site
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?
This comment was minimized by the moderator on the site
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?
This comment was minimized by the moderator on the site
How would you seperate unique values in a cell? ie. #2,#2,#3 I only want the #2 to appear once?
This comment was minimized by the moderator on the site
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.
This comment was minimized by the moderator on the site
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?
This comment was minimized by the moderator on the site
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!
This comment was minimized by the moderator on the site
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?
This comment was minimized by the moderator on the site
=SUMPRODUCT(1/COUNTIF(A1:A10,A1:A10))when you are selecting the range make sure that the cells should not be blank.
This comment was minimized by the moderator on the site
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!
There are no comments posted here yet
Load More
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations