Arrays 过滤通过Google Sheets中的查询动态创建的范围

Arrays 过滤通过Google Sheets中的查询动态创建的范围,arrays,sorting,google-sheets,google-sheets-formula,google-sheets-query,Arrays,Sorting,Google Sheets,Google Sheets Formula,Google Sheets 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,"select C,J,K,P where C is not null and J > 0"),{"","","",""});IFERROR(query('PI Calcs'!C104:P12

我当前正在使用此查询

=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)
通过使用QUERY,我将3个范围连接在一起。我使用IFERROR是因为如果任何查询返回一个空集,那么我就无法将它们合并在一起,失败的结果是一个包含4个值的空行

我的困难是从最终集合中删除这些空值,因为在对它们进行排序时,每个失败的查询都会得到一个空行。我尝试过使用FILTER,但由于该列是动态创建的,因此无法引用该范围中的列

<>如何从动态创建的范围中筛选空白行?
有没有一种方法可以在不返回空范围的情况下查询和连接结果?

为什么不查询您的查询

=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)
试试这个较短的:

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