【问题标题】:Having trouble with the query formula for a report in Google SheetsGoogle 表格中报告的查询公式有问题
【发布时间】:2018-12-31 05:01:02
【问题描述】:

这是我的公式。如果您发现任何问题,请评估并告诉我。

=(query(importrange("sheetLink","FormResponses"),"Select Col1, Col4, Col5 Where Col3 Contains '"&EmployeeName&"' And Col4 >= '"&ReportStartDate&"' And Col4 <= '"&ReportEndDate&"' And Col8 = '"&JobName&"'",-1))

您能提供的任何帮助将不胜感激。

【问题讨论】:

  • 尝试删除与号并在“FormResponses”表中提供一个范围。
  • 我认为如果 EmployeeName 等被命名为范围,查询本身看起来还不错
  • @JPV 删除 & 会产生 #ERROR!
  • @Tom Sharpe 它们被命名为范围。我收到 #N/A 错误,但即使使用通配符,产量也保持不变。
  • 您能分享一份您的电子表格副本,以便我们查看实际数据吗?

标签: date google-sheets google-query-language google-sheets-formula importrange


【解决方案1】:

您必须这样做以确保日期正常工作:

=query({A:H},"Select Col1, Col4, Col5 Where Col3 Contains '"&EmployeeName&"' And Col4 >= date '"&text(ReportStartDate,"yyyy-mm-dd")&"' And Col4 <= date '"&text(ReportEndDate,"yyyy-mm-dd")&"' And Col8 = '"&JobName&"'",1)

【讨论】:

    【解决方案2】:

    与 IMPORTRANGE 函数一起正常工作的实际函数如下:

    (query(IMPORTRANGE("1qDKiRFFFnX5ORvleTIAoEcxD0WDjGopvA5UqcWVOfNs","FormResponses"),"Select Col1, Col4, Col5, Col6, Col7, Col8, Col10 Where Col3= '"&amp;EmployeeName&amp;"' and Col4&gt;= Date '"&amp;Text(DateValue(ReportStartDate),"YYYY-MM-DD")&amp;"' and Col4&lt;= Date '"&amp;Text(DateValue(ReportEndDate),"YYYY-MM-DD")&amp;"' Format Col4 'MM/DD/YY', Col7 '$#,##0.00'",-1))

    【讨论】:

      猜你喜欢
      • 2023-01-21
      • 1970-01-01
      • 1970-01-01
      • 2020-05-24
      • 1970-01-01
      • 2020-03-17
      • 1970-01-01
      • 2021-06-10
      • 1970-01-01
      相关资源
      最近更新 更多