问题描述
我正在尝试确定范围内的所有非空白单元格是否都具有相同的值.
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
请参见通过SUMPRODUCT()细分计数不重复计数以获取更多信息.
See Count Unique with SUMPRODUCT() Breakdown for more information.
这篇关于如何检查范围内的所有非空白单元格都具有相同的值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!