以相同的公式查询,数组和排序函数

时间:2019-04-01 20:26:34

标签: google-sheets

我有一个ARRAY,它从表单中提取数据,然后使用QUERY将第1列中具有相同数据的行组合在一起,现在我需要按第2列中的数据按字母顺序排序。了解如何将该方面整合到给定的公式中。

此外,在公式中,我在线找到了(非常有帮助!),现在我得到的第一行数据在其余数据之前声明为“ max”,并在其后直接出现空白行...但是我不能摆脱他们中的任何一个!

任何帮助都会如此受到赞赏。

这是我目前正在使用的公式(该公式太长了,我无法弄清楚如何突出显示各个部分,对不起!这是“ SELECT”之后的最后一个子句,虽然这会引起奇怪的格式设置)

=QUERY({ARRAYFORMULA({
 'Raw Data'!C2:C1501&" "&'Raw Data'!D2:D1501,
 'Raw Data'!E2:E1501,
 'Raw Data'!H2:H1501,
 'Raw Data'!J2:J1501&'Raw Data'!K2:K1501&'Raw Data'!L2:L1501&'Raw Data'!M2:M1501&'Raw Data'!AK2:AK1501&'Raw Data'!AL2:AL1501&'Raw Data'!AM2:AM1501&'Raw Data'!AN2:AN1501&'Raw Data'!BF2:BF1501&'Raw Data'!BG2:BG1501&'Raw Data'!BH2:BH1501&'Raw Data'!BI2:BI1501,
 'Raw Data'!N2:N1501&'Raw Data'!Q2:Q1501&'Raw Data'!AO2:AO1501,
 'Raw Data'!P2:P1501&'Raw Data'!R2:R1501&'Raw Data'!AP2:AP1501,
 'Raw Data'!S2:S1501&'Raw Data'!T2:T1501&'Raw Data'!U2:U1535&'Raw Data'!V2:V1535&'Raw Data'!AK2:AK1535&'Raw Data'!AL2:AL1535&'Raw Data'!AM2:AM1535&'Raw Data'!AN2:AN1535&'Raw Data'!BF2:BF1535&'Raw Data'!BG2:BG1535&'Raw Data'!BH2:BH1501&'Raw Data'!BI2:BI1501,
 'Raw Data'!W2:W1501&'Raw Data'!Z2:Z1501&'Raw Data'!AV2:AV1501,
 'Raw Data'!Y2:Y1501&'Raw Data'!AA2:AA1501&'Raw Data'!AW2:AW1501,
 'Raw Data'!AB2:AB1501&'Raw Data'!AC2:AC1501&'Raw Data'!AD2:AD1501&'Raw Data'!AY2:AY1501&'Raw Data'!AZ2:AZ1501&'Raw Data'!BA2:BA1501&'Raw Data'!BN2:BN1501&'Raw Data'!BO2:BO1501&'Raw Data'!BP2:BP1501,
 'Raw Data'!AE2:AE1501&'Raw Data'!AH2:AH1501&'Raw Data'!BB2:BB1501,
 'Raw Data'!AG2:AG1501&'Raw Data'!AI2:AI1501&'Raw Data'!BC2:BC1501,
 'Raw Data'!CG2:CG1501,
 'Raw Data'!G2:G1501,
 'Raw Data'!BY2:BY1501&'Raw Data'!CA2:CA1501&'Raw Data'!CC2:CC1501})},
 "SELECT Col1,"&ArrayFormula(join(", ","Max(Col"&column(B1:O1)&")"))&"group by Col1",1)

1 个答案:

答案 0 :(得分:0)

=SORT(QUERY(QUERY({ARRAYFORMULA({
 'Raw Data'!C2:C&" "&'Raw Data'!D2:D,
 'Raw Data'!E2:E,
 'Raw Data'!H2:H,
 'Raw Data'!J2:J&'Raw Data'!K2:K&'Raw Data'!L2:L&'Raw Data'!M2:M&'Raw Data'!AK2:AK&'Raw Data'!AL2:AL&'Raw Data'!AM2:AM&'Raw Data'!AN2:AN&'Raw Data'!BF2:BF&'Raw Data'!BG2:BG&'Raw Data'!BH2:BH&'Raw Data'!BI2:BI,
 'Raw Data'!N2:N&'Raw Data'!Q2:Q&'Raw Data'!AO2:AO,
 'Raw Data'!P2:P&'Raw Data'!R2:R&'Raw Data'!AP2:AP,
 'Raw Data'!S2:S&'Raw Data'!T2:T&'Raw Data'!U2:U&'Raw Data'!V2:V&'Raw Data'!AK2:AK&'Raw Data'!AL2:AL&'Raw Data'!AM2:AM&'Raw Data'!AN2:AN&'Raw Data'!BF2:BF&'Raw Data'!BG2:BG&'Raw Data'!BH2:BH&'Raw Data'!BI2:BI,
 'Raw Data'!W2:W&'Raw Data'!Z2:Z&'Raw Data'!AV2:AV,
 'Raw Data'!Y2:Y&'Raw Data'!AA2:AA&'Raw Data'!AW2:AW,
 'Raw Data'!AB2:AB&'Raw Data'!AC2:AC&'Raw Data'!AD2:AD&'Raw Data'!AY2:AY&'Raw Data'!AZ2:AZ&'Raw Data'!BA2:BA&'Raw Data'!BN2:BN&'Raw Data'!BO2:BO&'Raw Data'!BP2:BP,
 'Raw Data'!AE2:AE&'Raw Data'!AH2:AH&'Raw Data'!BB2:BB,
 'Raw Data'!AG2:AG&'Raw Data'!AI2:AI&'Raw Data'!BC2:BC,
 'Raw Data'!CJ2:CJ,
 'Raw Data'!G2:G,
 'Raw Data'!BY2:BY&'Raw Data'!CA2:CA&'Raw Data'!CC2:CC})},
 "select Col1,"&JOIN(", ", "max(Col"&COLUMN(B1:O1)&")")&"
  group by Col1", 0),
 "where Col1 is not null"), 2, 1, 1, 1)

0