Counting the number of unique values

The following array formula returns the number of unique values in a range named Data:

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

The preceding formula is one of those “classic” Excel formulas that gets passed around the Internet. I don’t think anyone knows who originated it.

Useful as it is, this formula does have a serious limitation: If the range contains any blank cells it returns an error. The following array formula solves this problem:

{=SUM(IF(COUNTIF(Data,Data)=0,””,1/COUNTIF(Data,Data)))}

Add to Technorati Favorites


// Related Posted - GOOGLE!

Loading



Related Websites
No comments yet.

Leave a comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>