当预期为1时,COUNTIF返回0

时间:2018-04-02 12:56:56

标签: excel google-sheets

var array = [1, 2, 3, 4, 5, 6]
for i in (0...3).reversed() where i < array.count {
    array.remove(at: i)
}

print(array) // [5, 6]

我希望此公式返回=IF(COUNTIF(A28:AJ28,"*"&automation&"*") , "need", "no need")  但我得到'need'

我应该怎么改变它?

enter image description here

2 个答案:

答案 0 :(得分:3)

你的公式变得不必要了。

由于automation位于字符串之外,因此不会将其视为文字字符串,而COUNTIF函数内部会出现#NAME!错误,IF函数视为虚假。

以下工作正常:

=IF(COUNTIF(A28:AJ28,"*automation*"), "need", "no need")

答案 1 :(得分:3)

用双引号封装文本:

=IF(COUNTIF(A28:AJ28,"*" & "automation" & "*"), "need", "no need")
相关问题