如何在不拖拽的情况下将此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。
答案 0 :(得分:2)
使用此单个公式,您将获得全部收益
=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) '$00'"))
(请参阅单元格N3)。
如果只想返回第二列,则可以添加一个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),))