COUNT Unique Values in Microsoft Excel

What if you have a whole bunch of numbers and text characters in an array and you need to know how many unique numbers there are?

Perhaps you have a sales worksheet that lists a lot of part numbers in a column. You could use AutoFilter and check the drop-down list, but there are just too many to count manually.

Use an array formula for this. Array formulas, sometimes referred to as CSE formulas, require that after entering the formula, you press Ctrl+Shift+Enter, not just Enter.

This formula doesn’t count blank cells.

The entire formula is as follows (replace C3:C25 with the range of data you want the formula to check)

=SUM(IF(FREQUENCY(IF(LEN(C3:C25)>0,MATCH(C3:C25,C3:C25,0),""), IF(LEN(C3:C25)>0,MATCH(C3:C25,C3:C25,0),""))>0,1))

If you just want to count unique numbers, and not text, use the following formula instead:

=SUM(IF(FREQUENCY(C3:C25, C3:C25)>0,1))

OfficeArtilces.com debuted on May 26, 2005.

MrExcel.com provides examples of Formulas, Functions and Visual Basic procedures for illustration only, without warranty either expressed or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose. The Formulas, Functions and Visual Basic procedures on this web site are provided "as is" and we do not guarantee that they can be used in all situations.

Access®, Excel®, FrontPage®, Outlook®, PowerPoint®, Word® are registered trademarks of the Microsoft Corporation.
MrExcel® TM is a registered trademark of Tickling Keys, Inc.

All contents © 1998-2014 by MrExcel Consulting | All rights reserved