Add column based on contents of another

jhepn

New Member
Joined
Jun 28, 2004
Messages
19
Anyone know how to add the contents of one column based on the contents of another? I've done this before (long time ago) but can't remember. I think it was a sumproduct formula, but can't seem to make it work. Basic layout is below:
2;3;4;5;6
2;1;5;4;2
5;3;4;2;6
3;1;4;5;8
2;4;5;2;1

Where I'd like to add all the numbers in the 5th column if the number in the first is a 2 (so in this scenario, the result would be 6+2+1=9). Any help would be great! Thanks!
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
Anyone know how to add the contents of one column based on the contents of another? I've done this before (long time ago) but can't remember. I think it was a sumproduct formula, but can't seem to make it work. Basic layout is below:
2;3;4;5;6
2;1;5;4;2
5;3;4;2;6
3;1;4;5;8
2;4;5;2;1

Where I'd like to add all the numbers in the 5th column if the number in the first is a 2 (so in this scenario, the result would be 6+2+1=9). Any help would be great! Thanks!

How about:

=SUMIF(A1:A6,"=2",E1:E5)
 
Upvote 0
Here's the SumP version:

=SUMPRODUCT(--(A5:A9=D2),--(E5:E9))
D2 has my criteria value (your '2')

(CTRL+SHIFT+ENTER to commit the formula)
 
Upvote 0

Forum statistics

Threads
1,224,522
Messages
6,179,292
Members
452,902
Latest member
Knuddeluff

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top