Home > Blockchain >  How to sum consecutive highlighted cells within the same column?
How to sum consecutive highlighted cells within the same column?

Time:10-08

I have a table looks likes this:

enter image description here

How can I sum the consecutive green cells within the same column? So I will get something like this, where the consecutive rows are merged after the sum:

enter image description here

My conditional formatting rule is value >0 turns green and values <0 turns red. I want to compute results from column H only. I have tried using the code below but didn't work.

=SUMIFS(H4:H8763, "<0",H5:H8764,">0")

CodePudding user response:

If you do not mind not having merged cells, put this in I4:

=IF(AND($H4>0,OR($H5<0,$H5="")),SUMIFS($H$4:$H4,$H$4:$H4,">0")-SUM($I$3:$I3),"")

And drag it down the length of the data.

![enter image description here

  • Related