我正在尝试嵌套Google表格查询,但似乎无法正常使用。我有一个有效的公式,但问题是它将不同日期的学生混合在一起。该公式应返回TODAY()
和TODAY()+3
之间的所有学生,但应首先与TODAY()
个学生一起,然后由TODAY()+1
等完成。此刻,它列出了来自首先指定日期,然后再转到嵌套工作表“学生2级”。
我诉诸于嵌套查询,然后在尚未完成的最后提供一个条件。我需要查询在末尾共享相同的条件,以便列表按日期排序。另外,如果有一种方法可以操纵我当前的公式以按日期排序,那么仍然可以。
这是我希望在您的帮助下进行操作的公式:
={query('Students Level A'!A2:EC, " select EC where A is not null and not
B contains '-' and EC>=date"""&TEXT(TODAY(),"yyyy-mm-dd")&""" and
EC<=date"""&TEXT(TODAY()+3,"yyyy-mm-dd")&""" and not B matches '[\d- ]
{5}' order by EC");
query('Students Level B'!A2:EC, " select EC where A is not null and not B
contains '-' and EC>=date"""&TEXT(TODAY(),"yyyy-mm-dd")&""" and
EC<=date"""&TEXT(TODAY()+3,"yyyy-mm-dd")&""" and not B matches '[\d- ]
{5}' order by EC");
query('Students Level C'!A2:EC, " select EC where A is not null and not B
contains '-' and EC>=date"""&TEXT(TODAY(),"yyyy-mm-dd")&""" and
EC<=date"""&TEXT(TODAY()+3,"yyyy-mm-dd")&""" and not B matches '[\d- ]
{5}' order by EC")}
我正在寻找符合以下条件的东西:
={query('Students Level A'!A2:EC);query('Students Level
B'!A2:EC);query('Students Level C'!A2:EC), "select EC where A is not null
and not B contains '-' and EC>=date"""&TEXT(TODAY(),"yyyy-mm-dd")&""" and
EC<=date"""&TEXT(TODAY()+3,"yyyy-mm-dd")&""" and not B matches '[\d- ]
{5}' order by EC"}
在此公式中,我首先嵌套了查询,然后为所有查询提供了一个条件。但是这个公式不起作用。
答案 0 :(得分:0)
您需要这样做:
=QUERY({{'Students Level A'!A2:B, 'Students Level A'!EC2:EC};
{'Students Level B'!A2:B, 'Students Level B'!EC2:EC};
{'Students Level C'!A2:B, 'Students Level C'!EC2:EC}},
"select Col3
where Col1 is not null
and not Col2 contains '-'
and Col3 >= date '"&TEXT(TODAY(), "yyyy-mm-dd")&"'
and Col3 <= date '"&TEXT(TODAY()+3, "yyyy-mm-dd")&"'
and not Col2 matches '[\d- ] {5}'
order by Col3", 0)