Google表格中报表的查询公式有问题

时间:2018-12-31 05:01:03

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

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

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

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

2 个答案:

答案 0 :(得分:0)

您必须执行以下操作以确保日期正常运行:

=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)

enter image description here

答案 1 :(得分:0)

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

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