Count distinct values in Excel, including the first occurrence of duplicates
A list may contain values that appear once and others that appear several times. When you need the total number of different customers, products, departments, or other entries, each value should be counted only once, regardless of how many times it occurs.
Formula Helper Plus in Kutools for Excel includes Count distinct values in Excel (unique and 1st duplicate occurrences) for this calculation. Select the range, and Kutools creates the required SUMPRODUCT and COUNTIF formula without requiring you to write or remember it.
- What Count distinct values can do
- Benefits of Count distinct values
- How to use Count distinct values
- Tips for better results
- Best use cases
- About Formula Helper Plus
- Frequently Asked Questions

What Count distinct values can do
Count distinct values returns the number of different entries in a selected range. A value that appears once contributes one to the total, and a value that appears multiple times also contributes only one.
🔢 Count different values
Return one total showing how many different entries appear in the selected range.
1️⃣ Count each value once
Count a value once whether it appears in one cell or is repeated throughout the list.
🔄 Keep the result dynamic
Insert a formula that recalculates when values in the referenced range change.
🧮 Build the formula automatically
Create the SUMPRODUCT and COUNTIF combination by selecting only the source range.
Benefits of Count distinct values
Count distinct values simplifies a useful calculation that otherwise requires a nested array-style formula.
No formula memorization
Count distinct entries without remembering how SUMPRODUCT and COUNTIF must be combined.
Only one range to select
Specify the source range through a single labeled argument box.
Reduce syntax mistakes
Let Kutools create the reciprocal COUNTIF calculation and its required references.
Return a single summary value
Get the distinct count directly without first extracting a separate list of distinct entries.
How to use Count distinct values
In this example, customer names are stored in cells A2:A21. Several customers appear in multiple orders, but the required result is the number of different customers.
- Select cell C2, where you want to return the distinct count.
- Click Kutools > Formula Helper > Formula Helper Plus.

- In the Formula Helper Plus dialog box, switch to the Local tab, select the Count category and choose Count distinct values in Excel (unique and 1st duplicate occurrences).
- In the Range box, select cells A2:A21.

- Click OK. Kutools inserts the formula into cell C2 and closes the dialog box.

The generated formula follows this logic:
=SUMPRODUCT(1/COUNTIF(A2:A21,A2:A21)) COUNTIF determines how many times each value appears in the range. Dividing 1 by those occurrence counts distributes a total contribution of one across all occurrences of each value. SUMPRODUCT then adds those contributions, so every different customer is counted once.
📝 Note:
The selected range should not contain blank cells. This formula treats all blank cells together as one distinct value, which can increase the result by one.
Tips for better results
Prepare the source range consistently so entries that should match are counted as the same value.
- Exclude the header: Select only the data cells, such as A2:A21, rather than including the column heading.
- Remove blank cells: Blank cells are counted collectively as one distinct entry by this formula.
- Check leading and trailing spaces: Values such as "Acme Supplies" and "Acme Supplies " may be treated as different entries because of hidden spaces.
- Standardize imported data: Correct inconsistent punctuation, abbreviations, and spelling before counting.
- Remember that counting is not case-sensitive: COUNTIF treats values such as "ACME SUPPLIES" and "Acme Supplies" as the same entry.
- Use a bounded range: Select the actual data range instead of an entire column to avoid including large numbers of blank cells.
Best use cases
This calculation is useful whenever repeated records must be reduced to a single count of different entries.
Distinct customers
Count how many different customers appear in an order or transaction list.
Product and inventory records
Count different product codes, SKUs, brands, or inventory locations.
Employee and department lists
Count different employees, teams, departments, or office locations in repeated records.
Survey and event data
Count different respondents, attendees, answers, or registration codes.
About Formula Helper Plus
Formula Helper Plus is a formula library in Kutools for Excel that helps you find and insert useful formulas through a guided interface. Formulas are organized into categories, and each one provides labeled argument boxes and instructions explaining the required inputs. You can also create categories and formulas for calculations you use regularly, or share useful formulas to help expand the Online formula library.

- 🗂️ Category tools
- Category list: Browse formulas by category, such as Calculate, Compare, Count, Date, Lookup, and Text.
- Add category
: Create a category for organizing your own formulas. - Rename category
: Select a custom category, and click this button to rename it.
- 🧮 Formula tools
- Search: Enter keywords in the search box to find a formula by its name or purpose.
- Add formula
: Create a formula and assign it to a category. When defining the formula, enclose each variable argument in # signs, such as #Range#. - Edit formula
: Select a custom formula, and click this button to modify its formula, category, or description. - Copy formula
: Create an editable copy of the selected formula. This is useful when you want to build a new formula based on an existing one. - Upload formula
: Upload and share the selected formula to help us expand the Online formula library.
Frequently Asked Questions
What does “unique and 1st duplicate occurrences” mean?
A value that appears once is counted once. When a value appears several times, only one occurrence contributes to the final count. In other words, every different value is counted once.
Does this calculation return the distinct values themselves?
No. It returns only the number of different values in the selected range. It does not create a separate list of those values.
To extract the different values into a separate range, use Kutools > Formula Helper > Text > Extract cells with unique values (include the first duplicate value).
Are uppercase and lowercase values counted separately?
No. Because the formula uses COUNTIF, text matching is not case-sensitive. For example, ACME SUPPLIES and Acme Supplies are counted as the same value.
Are blank cells counted?
Yes. One or more blank cells in the selected range collectively contribute one to the distinct count. Remove blanks or select a range without blank cells when blanks should not be included.
Why is the result larger than expected?
Check for blank cells, leading or trailing spaces, spelling differences, and inconsistent punctuation. These can cause entries that look similar to be counted separately.
Does the result update when the source data changes?
Yes. Kutools inserts a formula, so the result recalculates when values within the referenced range change.
Can the range contain both numbers and text?
Yes. The formula can count distinct numbers and text values in the same range. Make sure values are stored consistently, because a number stored as text may be treated differently from a numeric value.
The Best Office Productivity Tools
Kutools for Excel - Helps You To Stand Out From Crowd
Kutools for Excel Boasts Over 300 Features, Ensuring That What You Need is Just A Click Away...
Office Tab - Enable Tabbed Reading and Editing in Microsoft Office (include Excel)
- One second to switch between dozens of open documents!
- Reduce hundreds of mouse clicks for you every day, say goodbye to mouse hand.
- Increases your productivity by 50% when viewing and editing multiple documents.
- Brings Efficient Tabs to Office (include Excel), Just Like Chrome, Edge and Firefox.
Table of Contents
- What Count distinct values can do
- Benefits of Count distinct values
- How to use Count distinct values
- Tips for better results
- Best use cases
- About Formula Helper Plus
- Frequently Asked Questions
Kutools for Excel
Brings 300+ advanced features to Excel
- 🧩 Overview
- 📥 Free Download
- 🎁 30-Day Free Trial available



: Create a category for organizing your own formulas.
: Select a custom category, and click this button to rename it.
: Create a formula and assign it to a category. When defining the formula, enclose each variable argument in # signs, such as #Range#.
: Select a custom formula, and click this button to modify its formula, category, or description.
: Create an editable copy of the selected formula. This is useful when you want to build a new formula based on an existing one.
: Upload and share the selected formula to help us expand the Online formula library.