How to prevent displaying the total sum of A + B if columns A + B are empty

numbers

I have inserted a running total formula in my numbers sheet.
It sums the total of Column H, which works fine.
However when cells in columns H are empty it will display the last sum, which I do not want.

How can I prevent displaying the last sum when Column A and B are empty?

enter image description here

enter image description here

Best Answer

You can extend the formula to check whether the value in the column to the left is empty or not:

=if(j3>0;sum(h$2:h3);"")