I’m trying to calculate the costs of purchased items for each business for every month. The problem I’m experiencing is that it will sum the whole of column
B. This is my current formula:
Qty is a negative number as they are being removed from the store room and then charged to the business.
Any help with this much appreciated!
You could just use a pivot table. However, I generally dislike them as I prefer to have more control over them than what Excel gives me.
There is no need to use SUMPRODUCT. SUMIFS is the formula you are looking for:
I’d suggest not using whole column references, but if it’s only a small workbook, it shouldn’t cause too much slow down.
I would suggest converting your data to an excel table. You can then refer to the data by column name.
If I understand you want to sum the cost for each Business unit for each month. This formula should work with slight adjustment on your part (since I can’t see your columns/rows).
=SUMPRODUCT(($A$2:$A$50=G$2)*($D$2:$D$50=$F3)*($C$2:$C$50*$B$2:$B$50)) - or if column "C" is the total =SUMPRODUCT(($A$2:$A$50=G$2)*($D$2:$D$50=$F3)*($C$2:$C$50))
G2to your month criteria
F3to your business criteria
And change your ranges accordingly
To break this down:
(A2:A50=G2) - Gets the cells that match the month criteria (D2:D50=F3) - Gets the cells that match the business criteria (C2:C50*B2:B50) - Multiply the Qty * Cost