回覆列表
-
1 # 瀟灑走過
-
2 # 將就咯X5
一、=SUM(DSUM(INDIRECT({"一","二","三","四","五","六"}&"年級彙總"&"!a1:e500"),5,$A$1:$A2));二、=SUM(SUMIF(INDIRECT({"一";"二";"三";"四";"五";"六"}&"年級彙總"&"!a:a"),"黃小",INDIRECT({"一";"二";"三";"四";"五";"六"}&"年級彙總"&"!e:e")));三、=SUMPRODUCT(SUMIF(INDIRECT({"一","二","三","四","五","六"}&"年級彙總"&"!a:a"),A2,INDIRECT({"一","二","三","四","五","六"}&"年級彙總"&"!e:e")))
方法有:
對於多個表,除了用sumif()+sumif+sumif()...外,Sumif函式支援多表同時求和,但必須用indirect函式生成對多個表的引用,即:
INDIRECT(ROW($1:$5)&"日!B:B")和INDIRECT(ROW($1:$5)&"日!C:C")用sumif組合起來,即:
=SUMIF(INDIRECT(ROW($1:$5)&"日!b:b"),A2,INDIRECT(ROW($1:$5)&"日!c:c"))
而上述的公式返回的每個表的求和結果,是一組數,最後還需要用sumrpoduct函式進行求和,即:
=SUMPRODUCT(SUMIF(INDIRECT(ROW($1:$5)&"日!b:b"),A2,INDIRECT(ROW($1:$5)&"日!c:c")))