# Excel sum using If

Hi,

I have 2 colums

A       B
Y        £15.00
Y        £20.00
-         £ -
Y        £30.00

I want to Sum total of B only if A has Y in it

Thanks

R8VI
###### Who is Participating?

Finance AnalystCommented:
Thats easy with SUMIF function:

=SUMIF(A1:A5,"Y",B1:B5)

This says look at range A1:A5 and where it finds "Y", include the relevant row from B1:B5.

if you find that you will need more than one criteria, there is also SUMIFS function which allows multiple criteria but would cover that separately if you so required.

Thanks
Rob H
0

Finance AnalystCommented:
In your sample above, the result of SUM(B1:B5) will be the same as the SUMIF because the row without the Y has zero anyway.

Thanks
Rob H
0

Commented:
see attached file.
Book1.xlsb
0

Commented:
I agree, although I often cannot see so good...

=SUMIF(A1:A4,"Y",B1:B4)
or
=SUMPRODUCT(1*(\$A\$2:\$A\$5="Y")*(\$B\$2:\$B\$5))
0

Older than dirtCommented:
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.