Home > database >  Exclude "this" cell from sum_range in SUMIF formula
Exclude "this" cell from sum_range in SUMIF formula

Time:05-24

I have the following table

enter image description here

and am using the following formula to sum a range per month using sumif in Google Sheets

=sumif($B:$B,$B1,$C:$C)

I would like the total value to be displayed in column C, which is the range I am summing.

I would like the total to be display in the same column as the sub entries. How do I exclude the cell containing the total value so the formula doesn't become self-referencing?

CodePudding user response:

If the total is in cell C1, then:

=sumif($B2:$B2000,$B1,$C2:$C2000)

Or you could name the ranges:

sales = $B2:$B2000

prices = $C2:$C2000

then:

=sumif(sales,$B1,prices)

Edit: As per the comment from pgSystemTester, Googlesheets allows the following construction:

=sumif($B2:$B,$B1,$C2:$C)
  • Related