Forum Discussion
Nicholas Cooke
Mar 29, 2025Copper Contributor
SUMIF. look for either of two values
I am trying to use SUMIF using to add numbers in a column if the search column finds either of two values. I though that I might be able to us the OR function as the second argument but I can't find how to do this.
The data that I have looks something like this:
A B C
1 12
1 18
1 43
1 90
1
2 25
2 8
2
3 17
3 4
4 3
4 8
I want to add all the numbers in B which have either 2 or 3 in the corresponding rows in column B.
Bothered if I can work our how.
Nick
Thanks. I did a work around by making an column which calculated the even numbers. Your suggestion is much more elegant.
Nick
You mention column B twice. If you want to sum numbers in column B where column A contains 2 or 3:
=SUMIFS(B1:B100, A1, A100, 2)+SUMIFS(B1:B100, A1:A100, 3)
or shorter:
=SUM(SUMIFS(B1:B100, A1:A100, {2, 3}))
or if there are no text values in column B:
=SUM(B1:B100*((A1:A100=2)+(A1:A100=3)))
- Nicholas CookeCopper Contributor
Thanks. I did a work around by making an column which calculated the even numbers. Your suggestion is much more elegant.
Nick