SUMIF具有多个工作表和相同的值

时间:2017-01-08 10:58:22

标签: excel excel-vba exception-handling nullpointerexception excel-formula vba

我正在使用它:

=SUMIF(A2:A223,”Lenovo_Core_I5″,B2:B222)-SUMIF(A2:A223,”Lenovo_Core_I5″,C2:C222)

它适用于同一张纸。但是,我使用多张纸,所以我尝试:

=SUMPRODUCT(SUMIFS(INDIRECT(New_Order!B1:B94),INDIRECT(New_Order!A1:A94),”Lenovo_Core_I7″))-SUMPRODUCT(SUMIFS(INDIRECT(New_Applying!C7:C32),INDIRECT(New_Applying!A7:A32),”Lenovo_Core_I7″))

但它显示#REF!错误。

请参阅以下内容:

enter image description here

2 个答案:

答案 0 :(得分:0)

不使用INDIRECT FUNCTION

尝试
 =SUMPRODUCT(SUMIF(New_Order!B1:B94,New_Order!A1:A94,”Lenovo_Core_I7″)) - 
SUMPRODUCT(SUMIF(New_Applying!C7:C32,New_Applying!A7:A32,”Lenovo_Core_I7″))

详细了解如何引用其他工作表Here

中的值

答案 1 :(得分:0)

您不需要INDIRECT或SUMPRODUCT。试试这个:

=SUMIFS(New_Order!B1:B94,New_Order!A1:A94,”Lenovo_Core_I7″) - 
SUMIFS(New_Applying!C7:C32,New_Applying!A7:A32,”Lenovo_Core_I7″)