如何使该查询正确?

时间:2019-05-03 03:48:18

标签: google-sheets array-formulas google-sheets-formula google-sheets-query

我正在使用此查询:

=IF(D1=TRUE,ARRAYFORMULA(QUERY({IFERROR(QUERY({
IFERROR(QUERY(A4:G,"select A,B,C,'30',E where A is not null and E contains 'Days' or E is null Label '30' '' ",0),{"","","","",""});
IFERROR(QUERY(A4:G,"select A,B,C,'60',F where A is not null and F contains 'Days' or F is null Label '60' '' ",0),{"","","","",""});
IFERROR(QUERY(A4:G,"select A,B,C,'90',G where A is not null and G contains 'Days' or G is null Label '90' '' ",0),{"","","","",""})},
"Select * where Col1 is not null",0),""), 
VALUE(REGEXEXTRACT(IFERROR(QUERY({
IFERROR(QUERY(A4:G,"select A,B,C,'30',E where A is not null and E contains 'Days' or E is null Label '30' '' ",0),{"","","","",""});
IFERROR(QUERY(A4:G,"select A,B,C,'60',F where A is not null and F contains 'Days' or F is null Label '60' '' ",0),{"","","","",""});
IFERROR(QUERY(A4:G,"select A,B,C,'90',G where A is not null and G contains 'Days' or G is null Label '90' '' ",0),{"","","","",""})},
"Select Col5 where Col1 is not null",0),""),"\d+"))}, "select Col1,Col2,Col3,Col4,Col5 where Col6 <=10 order by Col6")),""
)

enter image description here

我的问题是第一行(单元格I4)正在复制内容,而不是将其分成2行

该如何纠正?

1 个答案:

答案 0 :(得分:0)

尝试:

=IF(D1=TRUE,ARRAYFORMULA(QUERY({IFERROR(QUERY({
IFERROR(QUERY(A4:G,"select A,B,C,'30',E where A is not null and E contains 'Days' or E is null Label '30' '' ",0),{"","","","",""});
IFERROR(QUERY(A4:G,"select A,B,C,'60',F where A is not null and F contains 'Days' or F is null Label '60' '' ",0),{"","","","",""});
IFERROR(QUERY(A4:G,"select A,B,C,'90',G where A is not null and G contains 'Days' or G is null Label '90' '' ",0),{"","","","",""})},
"Select * where Col1 is not null",0),""), 
VALUE(REGEXEXTRACT(IFERROR(QUERY({
IFERROR(QUERY(A4:G,"select A,B,C,'30',E where A is not null and E contains 'Days' or E is null Label '30' '' ",0),{"","","","",""});
IFERROR(QUERY(A4:G,"select A,B,C,'60',F where A is not null and F contains 'Days' or F is null Label '60' '' ",0),{"","","","",""});
IFERROR(QUERY(A4:G,"select A,B,C,'90',G where A is not null and G contains 'Days' or G is null Label '90' '' ",0),{"","","","",""})},
"Select Col5 where Col1 is not null",0),""),"\d+"))}, "select Col1,Col2,Col3,Col4,Col5 where Col6 <=10 order by Col6", 0)),""
)