# [Solved] Calc formula help

Hi -

I've never done anything other than add (sum) a single column in Libreoffice Calc.

So now I have developed an accounting spreadsheet for my small business.

I need a formula that will add (sum) only certain cells in one column, while excluding cells in that same column if there's a number greater than zero in a cell in an adjacent column.

Example: I need the sum of cells E12-15, except there's a number greater than zero in G12 so E12 either needs to be ignored by the formula or subtracted from the sum. Likewise, on the same sheet, but in a different category, I need a sum for E18-21, however, there's a number greater than zero in G19 so the number in E19 needs to be ignored or subtracted.

Of course, I'd like the formula to be expandable as I add additional data to the different categories. In the two above examples, for instance, if I add data to E16, 17..., or E22, 23.... Of course, one category may expand into where a previous category exists as I add rows of data.

Can anyone help me with a formula for this and how I make the formula specific, and expandable, to a specific category of cells?

Thanks!