adding value only if criteria is true

G

gerryR

Hi all. I've 2 columns (see below)

1 20
3 35
2 10
5 20
4 25
2 30
1 30


I need to get the total for each number on the lefts corrosponding value on
the right.

ie. Total of 1=50
2=40
etc

I tried

=IF(D15:D21="1", SUM(F15:F21))

but no joy, can anyone shed some light?
thanks and regards
gR
 
B

Bondi

Hi gR,

If we say that your data is in column A and B then you can use SUMIF()
along the lines of :

=SUMIF(A1:A7,"=1",B1:B7)

Regards,
Bondi
 
D

daddylonglegs

Try SUMIF, i.e.

=SUMIF(D15:D21,1,F15:F21)

you only need to put quotes around the 1 if data in D15:D21 is text
rather than numeric
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top