如果两个条件同时出现,我正在使用Google工作表查询和子查询来获取列(Col3)中的单元格总和:
到目前为止,我已经使用查询来选择数据,并且我试图使用子查询来求和所需的值
如屏幕截图所示:
答案 0 :(得分:0)
相反,您将A79:H86
从图像中放入查询,然后调整G79:G86
以适合虚拟数组构造,并调整{2,9}
添加更多列(如那些隐藏的列),然后当然,如果您在Cols
中添加了更多内容,请调整{2,9}
=ARRAYFORMULA(QUERY({IFERROR(VLOOKUP(QUERY(QUERY(
{A79:H86},"select Col7, sum(Col3) group by Col7 label sum(Col3)''",0),
"select Col1",0),{G79:G86,A79:H86},{2,9},0), ),
QUERY({A79:H86},"select Col7, sum(Col3) group by Col7 label sum(Col3)''",0),
QUERY({A79:H86},"select sum(Col4) group by Col7 label sum(Col4)''",0)},
"select Col1, Col4, Col5, Col3, Col2 order by Col2",0))
仅求和Col3:
=ARRAYFORMULA(QUERY({IFERROR(VLOOKUP(QUERY(QUERY(
{A79:H86},"select Col7, sum(Col3) group by Col7 label sum(Col3)''",0),
"select Col1",0),{G79:G86,A79:H86},{2,9},0), ),
QUERY({A79:H86},"select Col7, sum(Col3) group by Col7 label sum(Col3)''",0)},
"select Col1, Col4, Col3, Col2 order by Col2",0))