Pinterest Pixel

Top 5 Methods to Count Distinct Values in Excel

John Michaloudis
In Microsoft Excel, efficiently counting distinct values is a crucial task for data analysis and reporting.
Whether you're managing customer lists or survey responses, knowing how to accurately tally unique entries can streamline decision-making.

In Microsoft Excel, efficiently counting distinct values is a crucial task for data analysis and reporting. Whether you’re managing customer lists or survey responses, knowing how to accurately tally unique entries can streamline decision-making.

Key Takeaways:

  • Understanding these in Excel is crucial. Unique values appear once, while distinct values include all occurrences, crucial for thorough data analysis.
  • Excel provides formulas  like UNIQUE and COUNTA for accurate counting of distinct values.
  • Options include COUNTIF, Advanced Filter, Remove Duplicates, PivotTables, and Power Query, each serving specific data analysis needs.

Top 5 Methods to Excel Count Distinct Values

Method 1: Using the COUNTIF Function

The COUNTIF function is one of the simplest ways to count distinct values in a range.

STEP 1: Select a new cell where you want the distinct count to appear.

Excel Count Distinct

STEP 2: Enter the following formula:

=SUM(1/COUNTIF(A2:A21, A2:A21))

Excel Count Distinct

This formula creates an array of 1 divided by the count of each value in the range, summing up to the distinct count.

Method 2: The Advanced Filter Option

The Advanced Filter option allows you to extract unique values from a list, which you can then count.

STEP 1: Select data you want to filter.

Excel Count Distinct

STEP 2: Go to the Data tab on the Ribbon, then click on Advanced.

Excel Count Distinct

STEP 3: In the Advanced Filter dialog box,

  • Select Copy to another location.
  • Specify the range for the data and the location to copy the unique values.
  • Check ‘Unique records only’.
  • Click OK.

Excel Count Distinct

STEP 4: Once the unique values are copied, use the COUNTA function to count them: COUNTA(C2:C17)

Excel Count Distinct

Method 3: Remove Duplicates

Excel’s built-in Remove Duplicates feature can also be used to count distinct values.

STEP 1: Select the cells containing your data.

Excel Count Distinct

STEP 2: Go to Data > Remove Duplicates.

Excel Count Distinct

STEP 3: In the Remove Duplicates dialog box, select the columns that need to be checked for duplicates.

Excel Count Distinct

STEP 4: Click OK. A message box will show the number of duplicate values removed and how many unique values remain.

Excel Count Distinct

Use the COUNTA function to count the remaining unique values.

Excel Count Distinct

Method 4: Pivot Tables

STEP 1: Select the data range and create a pivot table. Tick ‘Add this data to Data Model’.

Excel Count Distinct

STEP 2: Move Customer Name into the Values area.

Excel Count Distinct

STEP 3: Go to the “Value Field Settings”.

Excel Count Distinct

STEP 4: Change the method to “Distinct Count.”

Excel Count Distinct

Now you have the count of unique values!

Excel Count Distinct

Method 5: Power Query

Power Query in Excel that can be used for data transformation, including counting distinct values.

STEP 1: Go to Data > From Table/Range.

Excel Count Distinct

STEP 2: In the dialog box, select the range and click OK.

Excel Count Distinct

STEP 3: In the Power Query Editor, select the column you want to analyze.

Excel Count Distinct

STEP 4: Go to the Transform tab. Click on Group By.

Excel Count Distinct

STEP 5: In the Group By dialog box, select the column and choose Count Rows.

Excel Count Distinct

STEP 6: Click Close & Load.

Excel Count Distinct

Power Query will create a new table with a distinct count of values.

Excel Count Distinct

 

FAQs

Q1. How do distinct counts differ from unique counts in Excel?

Distinct counts consider all values but count duplicates only once, while unique counts include only those values that appear exactly once in your data.

Q2.How to count unique values across multiple columns in Excel?

Combine the SUM and COUNTIFS functions to count unique values across multiple columns in Excel. Don’t forget to enter the formula as an array if they’re not on Excel 365.

Q3. Why isn’t the distinct count functioning in Excel?

If the distinct count isn’t working, they might need to check for correct formula usage, hidden data, filters, or ensure data is formatted correctly.

Q4. Is there a count distinct function in Excel?

No, there isn’t a built-in count distinct function in Excel, but they can create one using formulas like COUNTA with UNIQUE, or use PivotTables or VBA.

Q5. How do unique values differ from distinct values?

Unique values appear only once in a dataset, with no duplicates. Distinct values include all different items in the dataset, irrespective of how many times they appear.

If you like this Excel tip, please share it


Founder & Chief Inspirational Officer

at

John Michaloudis is a former accountant and finance analyst at General Electric, a Microsoft MVP since 2020, an Amazon #1 bestselling author of 4 Microsoft Excel books and teacher of Microsoft Excel & Office over at his flagship MyExcelOnline Academy Online Course.

See also  The Best Guide to Edit PowerPoint Videos and Clips

Steps To Follow

Star 30 Days - Full Access Star

One Dollar Trial

$1 Trial for 30 days!

Access for $1

Cancel Anytime

One Dollar Trial
  • Get FULL ACCESS to all our Excel & Office courses, bonuses, and support for just USD $1 today! Enjoy 30 days of learning and expert help.
  • You can CANCEL ANYTIME — no strings attached! Even if it’s on day 29, you won’t be charged again.
  • You'll get to keep all our downloadable Excel E-Books, Workbooks, Templates, and Cheat Sheets - yours to enjoy FOREVER!
  • Practice Workbooks
  • Certificates of Completion
  • 5 Amazing Bonuses
Satisfaction Guaranteed
Accepted paymend methods
Secure checkout

Get Video Training

Advance your Microsoft Excel & Office Skills with the MyExcelOnline Academy!

Dramatically Reduce Repetition, Stress, and Overtime!
Exponentially Increase Your Chances of a Promotion, Pay Raise or New Job!

Learn in as little as 5 minutes a day or on your schedule.

Learn More!

Share to...