"Excel: Count Unique Values Based on Criteria"

Counting Unique Values in Excel with Specific Criteria

In the vast realm of data analysis, Excel remains a powerful and widely-used tool. One common task is counting unique values, but what if you want to count unique values based on specific criteria? Here's a step-by-step guide to help you achieve this.

Understanding the Problem

Let's say you have a dataset like this:

RegionSalespersonSales
EastJohn1000
EastJane1500
WestJohn2000
WestJane2500

You want to find out how many unique salespeople there are in each region, but only if their sales are above 1500.

How to count unique values in Excel: with criteria, ignoring blanks
How to count unique values in Excel: with criteria, ignoring blanks

Using COUNTIFS with Distinct Count

Excel's COUNTIFS function is a versatile tool for counting cells that meet multiple criteria. However, it doesn't inherently count unique values. To get around this, we can use a trick with the IF function and COUNTIF.

Step 1: Create a Helper Column

In a new column, use the IF function to mark cells that meet your criteria. In our case, that's sales above 1500:

=IF(B2>1500, "Yes", "No")

Finding and Counting Unique values with Example
Finding and Counting Unique values with Example

Step 2: Count Unique "Yes" Values

Now, use COUNTIF to count the number of "Yes" values in each region. Wrap this in an IFERROR function to display 0 if there are no matches:

=IFERROR(COUNTIF($C$2:$C$6, "Yes"), 0)

Automating the Process

While the above method works, it's not very efficient if you have a large dataset. A more automated approach involves using a PivotTable.

#Excel #Tricks: Make a distinct count of unique values - 3 Methods
#Excel #Tricks: Make a distinct count of unique values - 3 Methods

Using PivotTables for Unique Counts

PivotTables are a powerful way to summarize and analyze data. Here's how to use one to count unique values with criteria:

Step 1: Insert a PivotTable

Select your data and go to Insert > PivotTable. Choose where you want to place it.

Step 2: Add Rows and Values

Drag Region to Rows and Salesperson to Values. Right-click on Salesperson and select Value Field Settings. Choose Distinct Count and click OK.

Step 3: Filter the Data

Right-click on Sales in the Rows area and select Filter. Deselect any values below 1500.

The PivotTable will now show the number of unique salespeople in each region, but only if their sales are above 1500.

How to Count Unique Values in Excel
How to Count Unique Values in Excel
Return Multiple Values in Excel Based on Single Criteria (3 Options)
Return Multiple Values in Excel Based on Single Criteria (3 Options)
Top 21 Excel Formulas
Top 21 Excel Formulas
a poster showing the differences between counter and counter in an english language text is below it
a poster showing the differences between counter and counter in an english language text is below it
How to Count Unique Values In Google Sheets
How to Count Unique Values In Google Sheets
How to count duplicate values in a column in Excel?
How to count duplicate values in a column in Excel?
Distinct Count On Excel
Distinct Count On Excel
Identifying Excel Entries that Add Up to a Specific Value
Identifying Excel Entries that Add Up to a Specific Value
3 Ways to Remove Duplicates to Create a List of Unique Values in Excel - Excel Campus
3 Ways to Remove Duplicates to Create a List of Unique Values in Excel - Excel Campus
Excel COUNTIFS and COUNTIF with multiple AND / OR criteria - formula examples
Excel COUNTIFS and COUNTIF with multiple AND / OR criteria - formula examples
How to Use COUNT and COUNTA in Excel Step by Step
How to Use COUNT and COUNTA in Excel Step by Step
Excel COUNTIF function examples - not blank, greater than, duplicate or unique
Excel COUNTIF function examples - not blank, greater than, duplicate or unique
a table that has numbers on it with the words countifs function written below
a table that has numbers on it with the words countifs function written below
COUNTIF vs COUNTIFS in Excel (4 Examples)
COUNTIF vs COUNTIFS in Excel (4 Examples)
How to Count in Excel - Contextures Blog
How to Count in Excel - Contextures Blog
Unlock the power of your data with the COUNT function! 📊 This incredible Excel tool helps you quickly tally cells containing numbers, ignoring text, blanks, and logical values. Perfect for analyzing sales figures, inventory, or survey responses. Dive into data mastery! ✨ #ExcelTips #DataAnalysis #SpreadsheetHacks Ignore Text, Data Analysis, Logic, No Response
Unlock the power of your data with the COUNT function! 📊 This incredible Excel tool helps you quickly tally cells containing numbers, ignoring text, blanks, and logical values. Perfect for analyzing sales figures, inventory, or survey responses. Dive into data mastery! ✨ #ExcelTips #DataAnalysis #SpreadsheetHacks Ignore Text, Data Analysis, Logic, No Response
the basic excel formula is displayed in this screenshot
the basic excel formula is displayed in this screenshot
ms excel formula
ms excel formula
an excel spreadsheet with the text'code item size'highlighted in red
an excel spreadsheet with the text'code item size'highlighted in red
How to Count in Excel - Contextures Blog
How to Count in Excel - Contextures Blog
Use COUNTIF with Conditional Formatting in Excel
Use COUNTIF with Conditional Formatting in Excel
an excel advance formula with numbers and symbols
an excel advance formula with numbers and symbols
How to Count Unique Values in Excel
How to Count Unique Values in Excel