用空白计算唯一值excel公式 [英] Count unique values excel formula with Blanks

查看:38
本文介绍了用空白计算唯一值excel公式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用公式计算 excel 中的唯一值.我尝试使用下面的公式,但它返回 #DIV!/0 错误,因为我的范围中有空格.无论如何,是否可以使用公式计算包含空格的范围内的唯一值?任何有关此问题的帮助将不胜感激!

I am trying to count unique values in excel by using a formula. I have tried using the formula below but it returns a #DIV!/0 error because I have blanks in my range. Is there anyway to count unique values in a range with blanks by using a formula? Any help with this issue would be greatly appreciated!

=SUM(1/COUNTIF(Usage!J2:J6000,Usage!J2:J6000))

推荐答案

如果您必须补偿空白单元格,请使用公式并调整您的唯一计数的分子以检查非空白,然后添加一个零长度字符串COUNTIF 函数's 标准参数.

If you have to compensate for blank cells, take the formula and adjust the numerator of your count unique to check for non-blanks then add a zero-length string to the COUNTIF function's criteria argument.

=SUMPRODUCT((Usage!J2:J6000<>"")/COUNTIF(Usage!J2:J6000,Usage!J2:J6000&""))

检查分子中的非空白单元格意味着任何空白单元格都将返回零.无论分母是什么,任何分子为零的分数都将为零.附加到 COUNTIF 的条件部分的空字符串足以避免 #DIV/0!错误.

Checking for non-blank cells in the numerator means that any blank cell will return a zero. Any fraction with a zero in its numerator will be zero no matter what the denominator is. The empty string appended to the criteria portion of the COUNTIF is sufficient to avoid #DIV/0! errors.

更多信息请访问 使用 SUMPRODUCT() 分解计数唯一性.

这篇关于用空白计算唯一值excel公式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆