Exclude cells from cumulative sum

Hi Libreoffice users,

This is a simple version of my spreadsheet in Libreoffice Calc : http://i.imgur.com/bgOTpWf.png

The C column starts with the formula =SUM($B$1:$B1) and the second one is =SUM($B$1:$B2) and so on, to calculate the cumulative sum of row B. Now I would like to automatically exclude the total cells from row C. (Because my own spreadsheet is really long)

Thanks in advance!

Version:
LibreOffice 3.5.4.2
Build ID: 350m1(Build:2)
OS: Debian Wheezy

Use SUBTOTAL(9,...) instead of SUM(…), SUBTOTAL ignores results of formula cells that contain SUBTOTAL in their formula expression.

I didn’t know about subtotal, but generally I would just put subtotals in column D instead… Its a really bad Idea to mix values and subtotals in the same column. its very confusing, and if someone does a cut and paste into another document, you are gonna have a mess.

I agree that it’s a bad idea to put values and subtotals in the same column, but I’m going to print the spreadsheet and put it in a ring binder :wink:
The other spreadsheet looks different from the example, so it is not as confusing as the example.

C1: =B1
C2...: =C1+IF(A2="Total", 0, B2)