ArrayFormula + 多个 IMPORTRANGE + QUERY [英] ArrayFormula + multiple IMPORTRANGE + QUERY

查看:27
本文介绍了ArrayFormula + 多个 IMPORTRANGE + QUERY的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将一些电子表格导入到一个具有某些条件的电子表格中,不幸的是,如果其中一个电子表格没有返回任何数据,ARRAYFORMULA 会要求 ARRAY_LITERAL结果为空.

I want to import a few spreadsheets into one with some criteria, unfortunately if one of the spreadsheets doesn't return any data, the ARRAYFORMULA is asking for ARRAY_LITERAL instead of empty result.

我需要在 IFERROR 函数中使用什么,以便 ARRAYFORMULA 不附加任何内容并乐意继续?

What do I need to use in the IFERROR function so that ARRAYFORMULA appends nothing and is happy to continue?

这就是我现在所拥有的:

This is what I have now:

={
   QUERY(IMPORTRANGE("<spreadsheet>", "Range!B2:J"), "SELECT Col1, Col2, Col3, Col5, Col9 WHERE Col1 <> '' AND Col5 >= 18 ");
   IFERROR(QUERY(IMPORTRANGE("<spreadsheet2>", "Range!B2:K"), "SELECT Col1, Col3, Col2, Col4, Col6, Col10 WHERE Col10 <> '' AND Col6 >= 18"), "")
}

我用 IFERROR 包裹了第二个,但空字符串不是有效的 ARRAY_LITERAL,那么我可以做什么来代替它?

I wrapped the second one in IFERROR but the empty string is not a valid ARRAY_LITERAL, so what can I do instead of it?

完全错误:

在 ARRAY_LITERAL 中,数组文字缺少一行或多行的值.

In ARRAY_LITERAL, an Array Literal was missing values for one or more rows.

我意识到我可以给它一个具有相同列数的空行,例如 I1:N2 但您永远不知道是否可能需要使用这些列,然后查询需要更改.

I realised I could give it an empty row with the same number of columns like I1:N2 but you never know if you might need to use these columns and then the query would need to change.

推荐答案

我建议使用空的 数组:

=iferror(query(..., ...), {"", "", "", ..., ""} )

注意:

  • 您选择了 6 列,因此重复 "" 六次.

编辑

@Moseleyi.

有道理,但当然,它仍然产生空行,如果我将我的 ARRAYFORMULA 包装在 SORT 中,将首先显示空行,但是当我使用空单元格时,它们不会,可能是因为它们实际上是空值.但是我用 IFERROR(1/0) 替换了空字符串并且它起作用了.

Makes sense, but of course, it still produces empty rows, and if I wrap my ARRAYFORMULA in SORT, the empty rows will be shown first, but when I use empty cells they won't, probably because they're actually NULL. But I replaced empty strings with IFERROR(1/0) and it worked.

这篇关于ArrayFormula + 多个 IMPORTRANGE + QUERY的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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