简体   繁体   English

使用 Google 表格查询 function 并且它没有返回正确的行

[英]Using Google Sheets query function and it is not returning the correct rows

I am using the google sheets query function to dynamically pull data from another sheet into an easier to read sheet.我正在使用谷歌表格查询 function 将数据从另一张表格动态提取到更易于阅读的表格中。 This is me attempting to make google sheets into a functional database.这是我试图将谷歌表格制作成功能数据库。 An example table of the data is shown below.数据示例表如下所示。

Example Table of the Raw Data原始数据示例表

The query I am writing is我正在写的查询是

=QUERY(Raw_Data:A1,E10000, "select B where D = '"&D3&"' and C = '"&D2&"'",0)

which returns no results when D3 is equal to "Saturday, February 5" and当 D3 等于 "Saturday, February 5" 和
D2 is equal to "Wairakei 2". D2 等于“Wairakei 2”。

However, when replacing the "and" with an "or" and leaving the cells the same但是,当用“或”替换“和”并使单元格保持不变时

=QUERY(Raw_Data:A1,E10000, "select B where D = '"&D3&"' and C = '"&D2&"'",0)

this returns这返回

152646563 153237668 145802639 152646563 153237668 145802639

It seems like this should be the result I get with the "and" operator and is wrong for the "or" operator.看起来这应该是我使用“and”运算符得到的结果,而“or”运算符是错误的。 Any help on this issue would be gladly appreciated.对此问题的任何帮助将不胜感激。 Thanks in advance for your help.在此先感谢您的帮助。

If D3 is a date, use如果 D3 是日期,请使用

D = DATE'"&TEXT(D3,"yyyy-MM-dd")&"'

instead of D = '"&D3&"'而不是D = '"&D3&"'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM