19 September 2007

Count Unique Items

This is a phenomenally simple way to count the number of unique items in a column. I have seen some ridiculously long formulas for this in the past and this beats all of them:

{=SUM(1/COUNTIF(rngToCheck,rngToCheck))}

How simple is that?!

NB: This is an array formula, so don't actually type the curly brackets - they will appear when you enter the formula by pressing Ctrl+Shift+Enter all at the same time.

Example

Take the situation here:

Note the lack of curly brackets - DO NOT TYPE THESE IN.

Now, press Ctrl+Shift+Enter to enter the formula, and the curly brackets will magically appear:

No comments: