简体   繁体   中英

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. 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
D2 is equal to "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

It seems like this should be the result I get with the "and" operator and is wrong for the "or" operator. Any help on this issue would be gladly appreciated. Thanks in advance for your help.

If D3 is a date, use

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

instead of D = '"&D3&"'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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