Add numbers in column IF other column contains x

I have to columns of numbers. The numbers in column "B" define those in column "A" by colour ( or color).


number colour
2blue
3red
7green
5blue


I want to know the sum of the numbers in A where they are blue. The correct answer here is "7". So I must want something along the lines of A6=SUM A2..A5 WHERE B2..B5 is "blue". Or am I pointing in the wrong direction?!

Posted on Jan 5, 2015 8:52 AM

Reply
Question marked as Top-ranking reply

Posted on Jan 5, 2015 9:11 AM

=sumif(B,"blue", A)



if the formula is in column C


you could use:

=sumif(B,B2, A)

6 replies

Jan 5, 2015 10:30 AM in response to David Gordon

David,


SUM IF and SUMFS are different in one important way. SUM can only check one column, whereas SUMIFS can check multiple columns to determine what rows are included in the Sum. For some reason I can't explain, the syntax is reversed between the two versions.


SUMIF(test-values, condition, sum-values)


SUMIFS(sum-values, test-values, condition, test-values…, condition…)


Note that in SUMIF, the SUM value range is the last argument, and in SUMIFS the SUM value range is the first argument.


You may use SUMIFS even if you have only one condition to test for, so you could just as well have used:


=SUMIFS(A, B,"blue")


Regards,


Jerry

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Add numbers in column IF other column contains x

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.