Kriesinator
New Member
- Joined
- Sep 14, 2016
- Messages
- 4
I need to sum values from a range based on multiple criteria. First, are the values positive or negative. I have a cell that has "Positive" and "Negative" as a data filter. Then I have a data table similar to this:
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]Cat[/TD]
[TD]3[/TD]
[/TR]
[TR]
[TD]Cats[/TD]
[TD]-1[/TD]
[/TR]
[TR]
[TD]Cat[/TD]
[TD]4[/TD]
[/TR]
[TR]
[TD]Cats and Cat[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]Dog[/TD]
[TD]4[/TD]
[/TR]
[TR]
[TD]Cat and Dog[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]Cat and Mouse[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]Mouse[/TD]
[TD]-6[/TD]
[/TR]
</tbody>[/TABLE]
I need to be able to sum for positive or negative values for each "primary" row label, that is, the first whole word (or preferably fixed number of characters). So, when looking for positive "Dog", I want to return "4", from row 5, not "6", from the sum of row 5 and 6.
When I sum for "Cat", I want to return "10", excluding the "2" value from row 4.
I thought I could use some version of SUMIFS with one criteria as the positive value and the other as "LEFT(A1:A8,4)="Cat " to only include rows that start with "Cat_", but my syntax is not working or the "LEFT" command won't work with a range.
Any ideas on how to do this?
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]Cat[/TD]
[TD]3[/TD]
[/TR]
[TR]
[TD]Cats[/TD]
[TD]-1[/TD]
[/TR]
[TR]
[TD]Cat[/TD]
[TD]4[/TD]
[/TR]
[TR]
[TD]Cats and Cat[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]Dog[/TD]
[TD]4[/TD]
[/TR]
[TR]
[TD]Cat and Dog[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]Cat and Mouse[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]Mouse[/TD]
[TD]-6[/TD]
[/TR]
</tbody>[/TABLE]
I need to be able to sum for positive or negative values for each "primary" row label, that is, the first whole word (or preferably fixed number of characters). So, when looking for positive "Dog", I want to return "4", from row 5, not "6", from the sum of row 5 and 6.
When I sum for "Cat", I want to return "10", excluding the "2" value from row 4.
I thought I could use some version of SUMIFS with one criteria as the positive value and the other as "LEFT(A1:A8,4)="Cat " to only include rows that start with "Cat_", but my syntax is not working or the "LEFT" command won't work with a range.
Any ideas on how to do this?