【问题标题】:Use Google Query to return results based on an Array使用 Google Query 根据数组返回结果
【发布时间】:2022-01-01 18:50:12
【问题描述】:

我有一个查询数组material_items 的函数,我希望它选择第1 列与另一个数组item_list_typeids 匹配的所有行。现在,当数组中当前有 5 个项目时,它仅使用查询中 item_list_typeids 中的第一个单元格。该数组是动态的,并且可能不止 5 个项目。

=ARRAYFORMULA(IFNA(
QUERY({material_items}, "select * WHERE Col1 = "&item_list_typeids&"",0),
""))

如下图所示,item_list_typeids 中的第一项仅拉取了多行,因此仅数组中的 5 项的预期结果将超过十二行。

【问题讨论】:

    标签: google-sheets join concatenation google-query-language textjoin


    【解决方案1】:

    去:

    =IFNA(QUERY({material_items}, 
     "where Col1 matches '"&TEXTJOIN("|", 1, item_list_typeids)&"'", 0))
    

    【讨论】:

    • 那行得通,我只是想澄清一些事情。 “|”在谷歌查询语言中充当“或”?求日后参考,谢谢!
    • @MichaelJetzer 是的,| 代表OR 逻辑,但处于正则表达式模式。我们使用matches 启用了正则表达式模式
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-11-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多