如何检查范围内的所有非空白单元格都具有相同的值? [英] How to check that all non-blank cells in range have same value?

查看:36
本文介绍了如何检查范围内的所有非空白单元格都具有相同的值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试确定范围内的所有非空白单元格是否都具有相同的值.

I'm trying to determine whether all non-blank cells in a range have the same value.

此范围应返回TRUE:

This range should return TRUE:

45A
45A

45A
45A

此范围应返回FALSE:

This range should return FALSE:

45A
45B

45A
45A

如果范围为空白,则还应该返回TRUE.

If the range is blank, it should also return TRUE.

此答案之后,我尝试了以下方法:

Following this answer, I tried this:

=SUMPRODUCT(1/COUNTIF(L68:L72,L68:L72))=1

当范围中的每个单元格都有一个值时,此方法成功运行,但是如果范围中有任何空白单元格,则会出现#DIV/0!错误.如果有空白单元格,该如何工作?

This works successfully when every cell in the range has a value, but if there are any blank cells in the range, I get a #DIV/0! error. How can I make this work if there are blank cells?

推荐答案

调整您的 count不重复的分子以检查是否为空白,并将零长度的字符串添加到 COUNTIFS的标准争论.

Adjust the numerator of your count unique to check for non-blanks and add a zero-length string to the COUNTIFS's criteria arguement.

=SUMPRODUCT((L68:L72<>"")/COUNTIF(L68:L72,L68:L72&""))=1

请参见

See Count Unique with SUMPRODUCT() Breakdown for more information.

这篇关于如何检查范围内的所有非空白单元格都具有相同的值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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