LibreOffice: a simple question (sum certain numbers in a range)

I have a command like this: =SUM(G11:G159). Now I need to sum over numbers equal to -55 or -115. How can I achieve that?

Do you mean
= -55 * COUNTIF(G11:G159;-55) + -155 * COUNTIF(G11:G159;-155)
?

1 Like

Or even

=SUMIF(G11:G159;-55)+SUMIF(G11:G159;-155)
1 Like

Assuming the 2 values in question are in C1:C2

=SUM(SUMIF(G11:G159;C1:C2)

entered as matrix-formula with <ctrl><shift><enter>
or the respective [x]matrix-option in Formulawizard

Or with regular expressions enable.
=SUMIFS(G11:G159;G11:G159;"-55|-155")
or
=SUMPRODUCT(SUMIFS(G11:G159;G11:G159;{-55.-155}))
with dot as array column separator.

. dot as array column separator is confusing to read… IMHO.
(just a remark).

1 Like

You are right, but it’s the default, with en-us ui and es-es language.

I think ‘|’ should be the default for column separator in any language. Because coma for en-us language don’t looks much better.

1 Like

Comma at least is a common parameter separator in almost all programming languages.

You are right again, but doesn’t mean it is the best at view, IMHO.