Skip to content
Free Excel Tutorials
  • Home
  • Excel For Beginners
  • Excel Intermediate
  • Advanced Excel For Experts

Data Analysis

  • Conditional Formatting Rules in Excel
  • How To Remove Duplicates In Excel Column Or Row?
  • How to sum a total in multiple Excel tables
  • How to Create Column Chart in Excel
  • Use Data Form to input, edit and delete records in Excel

References

  • How to calculate two-way lookup VLOOKUP in Excel Table
  • Find Closest Match in Excel Using INDEX, MATCH, ABS and MIN functions
  • Offset in Excel
  • Get nth match with INDEX / MATCH in Excel
  • How to get first row number in range in Excel

Data Validations

  • Prevent invalid data entering in specific cells
  • Excel Data validation specific characters only
  • Excel Data validation only dates between
  • Excel Data validation number multiple 100
  • Excel Data validation exists in list

Count unique numeric values in a range in Excel

by

This tutorial shows how to Count unique numeric values in a range in Excel using the example below;

Formula

=SUM(--(FREQUENCY(data,data)>0))

Explanation

To count unique numeric values in a range, you can use a formula based on the FREQUENCY and SUM functions.

For example, assume you have a list of employee numbers together with hours worked on “Project X”, and you want know how many employees worked on that  project. Looking at the data, you can see that the same employee numbers appear more than once, so what you want is a count of the unique employee numbers that appear in the list.

The employee numbers appear in the range B3:B12. The formula in F3 is:

=SUM(--(FREQUENCY(B3:B12,B3:B12)>0))

How this formula works

The FREQUENCY function returns an array of values that correspond to “bins”. In this case, we supply the same set of numbers for both the data array and bins array.The result is that FREQUENCY returns an array of values that represent a count for each numeric values in the data array. This works because FREQUENCY has a special feature that automatically returns zero for any numbers that have already appeared in the data array. The return array looks like this:

{3;0;0;3;0;0;3;0;0;1;0}

Next, each of these values is tested to be greater than zero. The result looks is an array like this:

{TRUE;FALSE;FALSE;TRUE;FALSE;FALSE;TRUE;FALSE;FALSE;TRUE;FALSE}

Now each TRUE in the list represents a unique number in the list, and we just need to add up the TRUE values with SUM.

SUM won’t add logical values, so we first coerce the logicals to 1 or 0 with a double hyphen to get:

{1;0;0;1;0;0;1;0;0;1;0}

Finally, SUM adds these values up and returns the total, which in this case is 4.

Note: you could also use SUMPRODUCT to sum the items in the array.

Using COUNTIF instead of FREQUENCY to count unique values

Another way to count unique numeric values is to use COUNTIF instead of FREQUENCY. This is a much simpler formula, but beware that using COUNTIF on larger data sets to count unique values can cause performance issues. The FREQUENCY-based formula, while more complicated, calculates much faster.

Post navigation

Previous Post:

How to use Excel CHOOSE Function

Next Post:

Customize Ribbon In Excel

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Learn Basic Excel

Ribbon
Workbook
Worksheets
Format Cells
Find & Select
Sort & Filter
Templates
Print
Share
Protect
Keyboard Shortcuts

Categories

  • Charts
  • Data Analysis
  • Data Validation
  • Excel Functions
    • Cube Functions
    • Database Functions
    • Date and Time Functions
    • Engineering Functions
    • Financial Functions
    • Information Functions
    • Logical Functions
    • Lookup and Reference Functions
    • Math and Trig Functions
    • Statistical Functions
    • Text Functions
    • Web Functions
  • Excel VBA
  • Excel Video Tutorials
  • Formatting
  • Grouping
  • Others

Logical Functions

  • How to use Excel TRUE Function
  • IFS function: Description, Usage, Syntax, Examples and Explanation
  • Not Equal To ‘<>‘ operator in Excel
  • How to return blank in place of #DIV/0! error in Excel
  • SWITCH function example in Excel

Date Time

  • How to get Weekdays, Working days between Two Dates in Excel
  • Sum through n months in Excel
  • EOMONTH function: Description, Usage, Syntax, Examples and Explanation
  • Convert date string to date time in Excel
  • Get days, months, and years between dates in Excel

Grouping

  • Categorize text with keywords in Excel
  • Group times into unequal buckets in Excel
  • Calculate conditional mode with criteria in Excel
  • Group times into 3 hour buckets in Excel
  • Map text to numbers in Excel

General

  • AutoRecover file that was never saved in Excel
  • Count cells that do not contain errors in Excel
  • How to fill cell ranges with random number from fixed set of options in Excel
  • Cell References: Relative, Absolute and Mixed Referencing Examples
  • How to set or clear a print area in Excel Worksheet
© 2026 xlsoffice . All Right Reserved. | Teal Smiles | Abbreviations And Their Meaning