简体   繁体   中英

query and importrange function with condition btween two date and sort in order

I want to set query and importrange formula where i want the new sheet to show date that fall into today and yesterday date only and sort in ascending date and time

=QUERY(IMPORTRANGE(" https://docs.google.com/spreadsheets/d/1xk0Cvafixr5dayJkBkrzlYLFoA4E_PHYfPNQis12rc8/edit#gid=1702961582 ","CONSOLIDATE:A1,H"),"Select Col1,Col2,Col3,Col4,Col5,Col6,Col8 where Col1 <= date '"&text(B1,"yyyy-mm-dd")"' and >= date '"&text(B2,"yyyy-mm-dd")"' and order by Col1,Col2")")"

在此处输入图像描述

A couple of syntax errors, should be:

=QUERY(IMPORTRANGE("https://docs.google.com/spreadsheets/d/1xk0Cvafixr5dayJkBkrzlYLFoA4E_PHYfPNQis12rc8/edit#gid=1702961582","CONSOLIDATE!A1:H"),"Select Col1,Col2,Col3,Col4,Col5,Col6,Col8 where Col1 <= date '"&text(B1,"yyyy-mm-dd")&"' and Col1>= date '"&text(B2,"yyyy-mm-dd")&"' order by Col1,Col2")

ie remember to put '&' after the date as well as before, but don't put 'and' before order by.

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