简体   繁体   English

从 Google Sheet 公式中的单元格传递日期值

[英]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.

相关问题 从谷歌表中获取单元格值作为自定义日期格式 - get cell value as customize date format from google sheet 来自单元格值的 Google 工作表图表的数据范围(在图表编辑器中)公式 - Google Sheet Chart's Data Range (in Chart Editor) formula from cell value 用于增加工作表编号而不是Google工作表中单元格编号的公式 - Formula to increment value of sheet no and not the cell number in google sheets 如何获取单元格值(来自 Google 表单的 Sheet1,来自公式的 Sheet2)到谷歌文档模板 - How to get the cell values (Sheet1 from Google Form, Sheet2 from Formula) to google doc template Google Sheet 从单元格中提取第一个值 - Google Sheet extract first value from cell Google文件-参照储存格值中的工作表 - Google Docs - Reference a sheet from cell value 是否有 Google 表格公式可以将表格名称放入单元格中? - Is there a Google Sheets formula to put the name of the sheet into a cell? 正则表达式在谷歌表格单元格中查找特定公式 - REGEX to find a specific formula in a google sheet cell 当我在单元格 A 中输入值时如何在谷歌工作表中自动填充日期 - How to autofill date in google sheet when i enter value in cell A Google Sheet - 如何根据日期更改单元格值 - Google Sheet - How to change the cell value based on a date
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM