Google Sheets – A Function Opposed to SUMIF

formulasgoogle sheets

I have a huge list of matches between clubs and I want to calculate the goals for and the goals against.

I could find a way to calculate the goals for, using:

=SUMIF (A35:A46, "Liverpool", B35:B46) + SUMIF(D35:D46, "Liverpool", C35:C46)

The team being calculated the number of goals is organized like

Newcaste United 1 2 Liverpool
(where Newcastle is A1, NewcastleGoals is B1, LiverpoolGoals C1 and Liverpool, D1).

What I need is to find a function that is opposed to SUMIF so I can calculate the goals against Liverpool like SUMIF, instead of collecting the result cell by cell with the sum function.

Basically, the logic would be like the first example, but ignoring "Liverpool" and calculating all of the other strings:

=SUMIF (A1:A38, if not Liverpool, B1:B38) + SUMIF(D1:D38, if not Liverpool, C1:C38)

Thank you!

Best Answer

Have you tried <>?

=SUMIF (A1:A38, "<>Liverpool", B1:B38) + SUMIF(D1:D38, "<>Liverpool", C1:C38)

Not that the <>-symbols should be inside the quotation marks.