[英]Pass a Date value from a cell in Google Sheet formula
How do I re write this query for Google sheet, so that the dates in column B can be taken from a cell say X1 and X2我如何为 Google 工作表重新编写此查询,以便可以从单元格中获取 B 列中的日期,例如 X1 和 X2
=QUERY(master!A:N,"select B,D,H where B>=date '2021-10-01' and B<=date '2021-10-31' and (E='3-MonoYarnSupply' or E='4-MultiYarnSupply') label B 'Date',D 'Particulars',H 'Quantity Supplied'")
Expected formula预期公式
=QUERY(master!A:N,"select B,D,H where B>X1 and B<=X2 and (E='3-MonoYarnSupply' or E='4-MultiYarnSupply') label B 'Date',D 'Particulars',H 'Quantity Supplied'")
Where X1 = 01-10-2021 and X2 = 31-10-2021其中 X1 = 01-10-2021 和 X2 = 31-10-2021
您可以拆分公式并使用字符串连接逻辑来引用其他单元格,如下所示:
=QUERY(A:N,"select B,D,H where B>=date '" & TEXT(X1, "YYY-MM-DD") & "' and B<=date '" & TEXT(X2, "YYY-MM-DD") & "' and (E='3-MonoYarnSupply' or E='4-MultiYarnSupply') label B 'Date',D 'Particulars',H 'Quantity Supplied'")
B >= date '"&TEXT(X1,"yyyy-mm-dd")&"' and B <= date '"&TEXT(X3,"yyyy-mm-dd")&"' B >= 日期 '"&TEXT(X1,"yyyy-mm-dd")&"' 和 B <= 日期 '"&TEXT(X3,"yyyy-mm-dd")&"'
Thank you @Gangula.谢谢@Gangula。 Qualifying the date values as above in the query helped to achieve what I required.
在查询中限定日期值有助于实现我的要求。 Thank you for your time.
感谢您的时间。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.