**Unique Count in Excel**
==========================
There are several ways to get a unique count in Excel, and the best approach depends on your specific data and Excel version. Here are a few methods:
### **Method 1: Using `COUNTIF` and `SUMPRODUCT` (Excel 2010 and later)**
Suppose you have a list of values in column A, and you want to count the unique values.
```excel
=SUMPRODUCT(1/COUNTIF(A:A, A:A))
```
**How it works:**
1. `COUNTIF(A:A, A:A)` counts the occurrences of each value in column A.
2. `1/COUNTIF(A:A, A:A)` converts the counts to reciprocals (1/count). This will give 1 for unique values and a fraction for duplicate values.
3. `SUMPRODUCT` sums up these reciprocals, effectively counting the unique values.
### **Method 2: Using `UNIQUE` and `COUNT` (Excel 2019 and later)**
If you're using Excel 2019 or later, you can use the `UNIQUE` function.
```excel
=COUNT(UNIQUE(A:A))
```
**How it works:**
1. `UNIQUE(A:A)` returns an array of unique values from column A.
2. `COUNT` counts the number of values in this array.
### **Method 3: Using PivotTable (All Excel versions)**
You can also use a PivotTable to get a unique count.
1. Select your data range (e.g., A1:A100).
2. Go to "Insert" > "PivotTable".
3. Drag the field you want to count (e.g., column A) to the "Values" area.
4. Right-click on the field in the "Values" area and select "Value Field Settings".
5. Choose "Count distinct records" or "Distinct Count" (depending on your Excel version).
### **Method 4: Using `FILTERXML` and `COUNT` (Excel 2010 and later)**
This method is useful when you have a list of values with duplicates.
```excel
=COUNT(FILTERXML("<a><b>" & SUBSTITUTE(A:A, ",", "</b><b>") & "</b></a>", "//b[not(preceding-sibling::b/ text()[.=current()/text()])]))
```
However **It assumes values are comma-separated**
### **Recommendation**
* For most cases, **Method 1** (`SUMPRODUCT` and `COUNTIF`) is a good choice, as it's compatible with older Excel versions.
* If you're using Excel 2019 or later, **Method 2** (`UNIQUE` and `COUNT`) is a more straightforward and efficient approach.
=SUMPRODUCT(1/COUNTIF(A:A, A:A))