使用查询公式搜索其中单元格不是什么

Search with query formula where cells are not nothing

我有一系列单元格,想用查询公式搜索其中的单元格不是什么都没有。

    A   B   C   D
1   a   11  44  qw
2   b   12  r   
3   c   13  44  444
4   NOT         
5   f   15  55  88
6   NOT         
7   h   17  gh  ee

C 中的单元格可能是任何数字,可能是任何单词,也可能什么都没有。

我想select A 什么都没有,C 什么都没有。 结果必须是:

a
b
c
f
h

当尝试所有查询公式时:

=QUERY(A1:D7,"select A where not C<>'' ")
=QUERY(A1:D7,"select A where not C!='' ")
=QUERY(A1:D7,"select A where not C is null")
=QUERY(A1:D7,"select A where C !='' or not C is null")

没有给出正确的结果。到处看。

我能做什么?

=QUERY(A1:D7, "select A where C is not null")

...正是您所需要的

Google QUERY 函数在这里不起作用,因为 "expected" 因为 C 列中的混合数据类型。如果我们应用公式 =QUERY(A1:C7;"select A where C is not null";-1) 它只会 return "a, c and f"。下图在 G 列中显示了此结果,其中 G1 包含上述公式。

我们应该更仔细地检查数据类型,但是在QUERY 函数中很难做到。所以我建议再添加一列(在我们的例子中是 E)并用“=TYPE(C1)”和类似的函数填充它。有了数据类型列,我们可以修改 QUERY 表达式以将它们考虑在内。最终结果显示在 H 列中。

如果您要在 C 列中使用 other data types,请再次检查此方法。