My goal is to add all the cells of a columns and the subtract the sum of cells of several other columns, meeting a certain criterion.

So I found SUM(IF(...)). SUMIF didn't work because you could add the cells of more than one column (e.g. A2:C:10 doesn't work). So I wanted to add the cells of a column and then subtract the sum of cells of several other columns.

So what I did was something like

Code:

`{SUM(IF('Sheet 1'!A2:A200="YES",'Sheet 1'!B2:B:200)-SUM(IF('Sheet 1'!A2:A200="YES",'Sheet 1'!C2:F:200))}`

The reason why I'm asking this is that this somewhat synthetic formula works only for consecutive columns, but if I have all sorts of non-consecutive columns spread all over the worksheet, then I'd have to write another function (SUM(IF...)) for each group of columns, which not that nice.

Any ideas?