如何按谷歌表格中的两列过滤

时间:2021-03-03 00:57:12

标签: google-apps-script google-sheets google-sheets-formula google-sheets-api

给定这个 table 和这两对,我怎样才能(从 UI)过滤那个表,以便我能看到这两个的完整行?

我已尝试填写 filter by condition->custom formula->

=QUERY(A:B; "where A='2021-01-25' and B='domain3'"; 0)

=QUERY(A:B; "where A='2021-01-27' and B='domain1'"; 0)

但它没有返回任何结果,而且我想得到 2 对。

  1. 这是在 filter by condition 中使用公式的方式吗?

  2. 如果简化,我可以使用应用程序脚本。

enter image description here

1 个答案:

答案 0 :(得分:1)

将 A 列中的日期转换为纯文本,然后使用以下公式:

=QUERY(A:B, "select * where (A='2021-01-25' and B = 'domain3') or (A='2021-01-27' and B = 'domain1') ")

加入多个表:

=QUERY({A:B;G:H}, "select * where (Col1='2021-01-25' and Col2 = 'domain1') or (Col1='2021-01-26' and Col2 = 'domain2') order by Col1 ")

enter image description here