提问者:小点点

条件为btween两个日期和排序顺序的查询和映射函数


我想设置查询和修改公式,使新工作表显示日期,只属于今天和昨天的日期,并按升序日期和时间排序

=query(IMPORTRANGE(“https://docs.google.com/spreadsheets/d/1xk0cvafixr5dayjkbkrzlylfoa4e_phyfpnqis12rc8/edit#gid=1702961582”,“consolided!a1:h”),“select Col1,Col2,Col3,Col4,Col5,Col6,Col8其中Col1<=日期‘”&text(B1,“yyyy-mm-dd”)“’和>=日期‘”&text(B2,“yyyy-mm-dd”)“’和order by Col1,


共1个答案

匿名用户

有几个语法错误,应该是:

=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")

例如,记住在date之后和之前都要加上'&',但不要在order by之前加上'and'。