查询使用包含引用单元格值导致解析错误

时间:2019-09-19 13:55:21

标签: google-sheets-query

我正在尝试根据单元格值查询结果,似乎包含条件导致解析错误。我在做什么错了?

查询:

=QUERY(Company_overview!A2:L,"SELECT * WHERE B CONTAINS "&B3&" AND L >= datetime '"&TEXT(today()-B4,"yyyy-MM-dd HH:mm:ss")&"' AND L <= datetime '"&TEXT(NOW(),"yyyy-MM-dd HH:mm:ss")&"' ")")"

图片: Query

1 个答案:

答案 0 :(得分:0)

我最终找到了正确查询的答案:

=QUERY(Company_overview!A2:L,"SELECT * WHERE B='"&B3&"' AND L >= datetime '"&TEXT(today()-B4,"yyyy-MM-dd HH:mm:ss")&"' AND L <= datetime '"&TEXT(NOW(),"yyyy-MM-dd HH:mm:ss")&"' ")