Likewise: total sales of products = 100
apple = 40
orange = 60
how to find out customers who have brought only oranges and apples?
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.
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.
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!
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:
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.
2. Then press Enter key, and the number of the unique value will be displayed. See screenshot:
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))
After enter the formula, then remember to press Shift + Ctrl + Enter keys, and the number of unique values has been displayed.
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:
2. And in the Advanced Filter dialog box:
3. After finishing the settings, click OK, the unique values have been listed in a new column, see screenshot:
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.
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:
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:
4. (1.) If you choose Unique values only, only the unique values will be counted and selected at once. See screenshot:
(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: