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

Having trouble with the query formula for a report in Google Sheets

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

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

实际使用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))