【问题标题】:How can I filter by two columns in google sheets如何按谷歌表格中的两列过滤
【发布时间】:2021-03-03 00:57:12
【问题描述】:

鉴于此 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. 如果简化的话,我可以使用应用程序脚本。

【问题讨论】:

  • @player0 也许你会知道
  • 为什么使用标签 google-apps script 和 google-sheets-api?

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


【解决方案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 ")

【讨论】:

  • 但是我怎样才能得到 2 双呢? <date1, domain1><date2, domain3>?
  • 谢谢,我可以从过滤数据 ui 菜单中进行操作吗?如我的截图所示?
  • @EladBenda 那是不可能的,因为如果你过滤两列,它会给你所有的结果,而不是确切的对。
  • 说我在工作表的另一个 2 列表中有这些对。如何自动创建您的公式?这意味着我有点想加入这两个表。看我的新截图。 i.stack.imgur.com/pWP5R.png
  • @EladBenda 我更新了我的答案。如果您不想对它们进行排序,可以省略order by Col1
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2020-10-20
  • 2017-09-29
  • 2019-10-19
  • 2020-05-28
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多