Hi kwyjibo,
Yes, you're right that using
SUMIF across multiple sheets can be a bit tricky, but there is a more elegant way to do it using the
SUMPRODUCT function.
Here's an example formula that should work for you:
Formula:
=SUMPRODUCT(SUMIF(INDIRECT("'"&SheetList&"'!$B$3:$B$52"),Total!$A3,INDIRECT("'"&SheetList&"'!C$3:C$52")))
In this formula, "
SheetList" is a named range that contains a list of all the sheet names you want to include in the calculation. You can create this named range by selecting all the sheet tabs you want to include, right-clicking, and selecting "Rename" to give them all a common prefix (e.g. "DP"), then selecting all those tabs again and creating a named range with the formula
- =MID(GET.WORKBOOK(1),FIND("]",GET.WORKBOOK(1))+1,255)&"DP"&ROW(INDIRECT("1:52" ))
Here's how the formula works:
- The INDIRECT function is used to create a range reference that includes all the sheets in the SheetList range. The "&" operator is used to concatenate the sheet name with the cell range reference.
- The SUMIF function is used to search for values in column B that match Total!A3, and sum the corresponding values in column C.
- The SUMPRODUCT function is used to sum the results of the SUMIF function across all the sheets in the SheetList range.