SUMIF
requires at least 2 parameters, and at most 3. In your case, you will need to use 3.
If you type the formula in excel, you will see a little balloon indicating:
=SUMIF(Range, Criteria, [Sum_Range])
Range
is the range where you want to apply the condition, in your case, A:A
.
Criteria
is the condition applied to the range, in your case "x"
.
[Sum_Range]
is the range to sum, after applying the condition.
The above will sum all the cells in the range [Sum_Range]
, for which the cells of Range
satisfies the condition Criteria
.
Translating that into an actual formula, you get pnut's formula:
=SUMIF(A:A,"x",B:B)
The above will sum all the cells in the range B:B
, for which the cells of A:A
satisfies the condition x
(SUMIF
considers the criterion as being 'equal' so it will sum only when they are equal to the criteria).
As an extra, you can change the condition to mean 'not equal' by using something like this: =SUMIF(A:A,"<>x",B:B)
(the <>
means not equal to in Excel).