我目前正在使用这个查询
=sort({IFERROR(query('PI Calcs'!C4:K51,"select C,G,H, K where C is not null and G > 0"),{"","","",""});IFERROR(query('PI Calcs'!C54:P101,"select C,J,K,P where C is not null and J > 0"),{"","","",""});IFERROR(query('PI Calcs'!C104:P127,"select C,J,K,P where C is not null and J > 0"),{"","","",""})},2,false)通过使用查询,我将三个区域连接在一起。我使用IFERROR是因为如果任何查询返回一个空集,那么我就不能将它们合并在一起,失败的结果是一个由4个值组成的空行。
我的困难是从最后一组中删除那些空值,因为在对这些值进行排序时,我会为每个失败的查询获得一个空行。我尝试过使用FILTER,但由于它是动态创建的,因此无法引用范围中的列。
如何将空白行筛选出动态创建的范围?是否有一种在不返回空范围的情况下查询和加入结果的方法?
发布于 2020-02-13 21:12:11
试试这个短一点的:
=QUERY(SORT({IFERROR(QUERY('PI Calcs'!C4:K51,
"select C,G,H,K
where C is not null
and G > 0"), {"","","",""});
IFERROR(QUERY({'PI Calcs'!C54:P101; 'PI Calcs'!C104:P127},
"select Col1,Col8,Col9,Col14
where Col1 is not null
and Col8 > 0"), {"","","",""}), 2, 0),
"where Col1 is not null", 0)甚至更短:
=QUERY({'PI Calcs'!C54:P101; 'PI Calcs'!C104:P127;
{'PI Calcs'!C4:I51, 'PI Calcs'!G4:L51,'PI Calcs'!K4:K51}},
"select Col1,Col8,Col9,Col14
where Col1 is not null
and Col8 > 0
order by Col2 desc", 0)发布于 2020-02-13 19:48:13
为什么不查询你的查询呢?
=QUERY({IFERROR(query('PI Calcs'!C4:K51,"select C,G,H, K where C is not null and G > 0"),{"","","",""});IFERROR(query('PI Calcs'!C54:P101,"select C,J,K,P where C is not null and J > 0"),{"","","",""});IFERROR(query('PI Calcs'!C104:P127,"select C,J,K,P where C is not null and J > 0"),{"","","",""})},"where Col1 is not null order by Col2 desc",0)https://stackoverflow.com/questions/60214935
复制相似问题