ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   adding value only if criteria is true (https://www.excelbanter.com/excel-worksheet-functions/98024-adding-value-only-if-criteria-true.html)

gerryR

adding value only if criteria is true
 
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



Bondi

adding value only if criteria is true
 

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


daddylonglegs

adding value only if criteria is true
 

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


--
daddylonglegs
------------------------------------------------------------------------
daddylonglegs's Profile: http://www.excelforum.com/member.php...o&userid=30486
View this thread: http://www.excelforum.com/showthread...hreadid=559256


gerryR

adding value only if criteria is true
 
Perfect!

thaks for the very fast reply Bondi!
gR


"Bondi" wrote in message
ups.com...

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





All times are GMT +1. The time now is 02:21 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com