1

There's a formula that is so useful to me on http://office.microsoft.com/en-us/excel-help/count-occurrences-of-values-or-unique-values-in-a-data-range-HP003056118.aspx

It's this:

=SUM(IF(FREQUENCY(MATCH(B2:B10,B2:B10,0),MATCH(B2:B10,B2:B10,0))>0,1))

Which is described on its site as: "Count the number of unique text and number values in cells B2:B10 (which must not contain blank cells)"

My problem is I need it to allow for blank cells interspersed in the range, but just not count those.

Thank you for any help.

4

2 回答 2

1

但在链接页面上有公式:

=SUM(IF(FREQUENCY(IF(LEN(A2:A10)>0,MATCH(A2:A10,A2:A10,0),""), IF(LEN(A2:A10)>0,MATCH(A2:A10,A2:A10,0),""))>0,1))   

这被描述为:

计算单元格 A2:A10 中唯一文本和数值的数量,但不计算空白单元格或文本值 (6)

那有什么问题?它允许有空格吗?

于 2012-08-31T12:25:33.533 回答
1

Juliusz 发布的公式对我有用,它忽略空白并计算不同非空白值的数量(我认为“唯一”一词在描述中被滥用),这是你需要的吗?

公式需要使用 CTRL+SHIFT+ENTER 进行“数组输入”,以便像 { 和 } 这样的花括号出现在公式周围。

给出相同结果的替代公式(不需要数组条目)是

=SUMPRODUCT((B2:B10<>"")/COUNTIF(B2:B10,B2:B10&""))

于 2012-08-31T14:22:14.037 回答