Fill Google Sheets QUERY 向下列

Fill Google Sheets QUERY down column

如何在不拖动的情况下将 QUERY 填入一列?

=SUM(
  QUERY(
   {
    'Report: Materials List'!B9:B,
    'Report: Materials List'!C9:C,
    'Report: Materials List'!D9:D,
    'Report: Materials List'!E9:E,
    'Report: Materials List'!F9:F,
    'Report: Materials List'!G9:G,
    'Report: Materials List'!H9:H,
    'Report: Materials List'!I9:I
   },
  "SELECT Col4*Col6 WHERE Col1 = '"&A3&"' AND Col2 = '"&B3&"' AND Col1 IS NOT NULL LABEL Col4*Col6 '' format Col4*Col6 '$#'",0
 )
)

QUERY 在 J3 中,考虑到 A3:A 和 B3:B.

中的唯一值,我希望它适用于 J3:J

My sample sheet

你可以得到所有,用这个单一的公式

=ArrayFormula(query({'Report: Materials List'!B9:C, 'Report: Materials List'!E9:E * 'Report: Materials List'!G9:G}, "Select Col1, Col2, sum(Col3) where Col1 <>'' group by Col1, Col2 label sum(Col3) '' format sum(Col3) '[=10=]'"))

(参见单元格 N3)。

如果您只想return第二列,您可以添加一个vlookup来匹配A列和B列中的值。

=ArrayFormula(if(len(A3:A&B3:B), vlookup(A3:A&B3:B, query({'Report: Materials List'!B9:B&'Report: Materials List'!C9:C, 'Report: Materials List'!E9:E * 'Report: Materials List'!G9:G},"Select Col1, sum(Col2) where Col1 <>'' group by Col1 label sum(Col2) ''"), 2, 0),))