When data in cells from two different columns match, take sum of corresponding data from third column

Python49

New Member
Joined
Aug 18, 2018
Messages
32
Hello,

I have been having some trouble figuring out a SUMSIF or SUMPRODUCT formula to accomplish this, as well as searching on google and the forums for some time. Can someone please help me with the formula to accomplish the following:

Three columns of data, A, B, C:


[TABLE="width: 500"]
<tbody>[TR]
[TD]Chris[/TD]
[TD]Chris[/TD]
[TD]100[/TD]
[/TR]
[TR]
[TD]Dan[/TD]
[TD][/TD]
[TD]150[/TD]
[/TR]
[TR]
[TD]Doug[/TD]
[TD][/TD]
[TD]200[/TD]
[/TR]
[TR]
[TD]Jim[/TD]
[TD]Jim[/TD]
[TD]250[/TD]
[/TR]
[TR]
[TD]Mary[/TD]
[TD][/TD]
[TD]300[/TD]
[/TR]
</tbody>[/TABLE]


I'd like the values from the third column to be sum'd when cells from A and B match please. In the above example it would be 100 for Chris and 250 for Jim, totaling to 350.
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
Welcome to the MrExcel board!

Try this

Excel Workbook
ABCDE
1
2ChrisChris100350
3Dan150
4Doug200
5JimJim250
6Mary300
Sum
 
Upvote 0
Welcome to the MrExcel board!

Try this

Sum

ABCDE
ChrisChris
Dan
Doug
JimJim
Mary

<colgroup><col style="font-weight:bold; width:30px; "><col style="width:49px;"><col style="width:49px;"><col style="width:40px;"><col style="width:56px;"><col style="width:40px;"></colgroup><tbody>
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]1[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]2[/TD]

[TD="align: right"]100[/TD]

[TD="align: right"]350[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]3[/TD]

[TD="align: right"]150[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]4[/TD]

[TD="align: right"]200[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]5[/TD]

[TD="align: right"]250[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]6[/TD]

[TD="align: right"]300[/TD]

</tbody>

Spreadsheet Formulas
CellFormula
E2=SUMPRODUCT(--(A2:A6=B2:B6),C2:C6)

<tbody>
</tbody>

<tbody>
</tbody>


Excel tables to the web >> Excel Jeanie HTML 4
Hi Peter, thanks for the speedy reply! Upon doing this I have now found why I wasn't able to get it to work before. I didn't explain I think what I was hoping to do correctly. In the above example, what I actually need, but not sure if excel can do it (although I'm hopeful since I haven't seen much that excel can't do!!) is for the following:

[TABLE="width: 500"]
<tbody>[TR]
[TD]Chris[/TD]
[TD]$50[/TD]
[TD][/TD]
[TD]Mary[/TD]
[/TR]
[TR]
[TD]Dan [/TD]
[TD]$25[/TD]
[TD][/TD]
[TD]n/a[/TD]
[/TR]
[TR]
[TD]Doug[/TD]
[TD]$50[/TD]
[TD][/TD]
[TD]n/a[/TD]
[/TR]
[TR]
[TD]Jim [/TD]
[TD]$35[/TD]
[TD][/TD]
[TD]Chris[/TD]
[/TR]
[TR]
[TD]Mary[/TD]
[TD]$40[/TD]
[TD][/TD]
[TD]n/a[/TD]
[/TR]
</tbody>[/TABLE]


Example above, column A has the names of people, column B has how much they get paid if they attend a meeting/job/event/etc. If their name shows up on column C then they get paid the amount next to their name, but their name might not be in order for column C. Is there a way to get the total? For example, in the above example, because Mary and Chris are both on the list, the total amount to be paid is $50+$40 = $90 total for Mary and Chris.
 
Upvote 0
I didn't explain I think what I was hoping to do correctly.
That does make a difference - it is all we have to go on. :)

Try this version.

Excel Workbook
ABCDE
1
2Chris$50Mary90
3Dan$25n/a
4Doug$50n/a
5Jim$35Chris
6Mary$40n/a
Sum
 
Upvote 0
That does make a difference - it is all we have to go on. :)

Try this version.

Sum

ABCDE
ChrisMary
Dann/a
Dougn/a
JimChris
Maryn/a

<colgroup><col style="font-weight:bold; width:30px; "><col style="width:56px;"><col style="width:56px;"><col style="width:56px;"><col style="width:24px;"><col style="width:37px;"></colgroup><tbody>
[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]1[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]2[/TD]

[TD="align: right"]$50 [/TD]

[TD="align: right"]90[/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]3[/TD]

[TD="align: right"]$25 [/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]4[/TD]

[TD="align: right"]$50 [/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]5[/TD]

[TD="align: right"]$35 [/TD]

[TD="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=cacaca]#cacaca[/URL] , align: center"]6[/TD]

[TD="align: right"]$40 [/TD]

</tbody>

Spreadsheet Formulas
CellFormula
E2=SUMPRODUCT(--ISNUMBER(MATCH(A2:A6,C2:C6,0)),B2:B6)

<tbody>
</tbody>

<tbody>
</tbody>


Excel tables to the web >> Excel Jeanie HTML 4
Marvelous! Great thanks :)
 
Upvote 0
I had one more question which I'd LOVE if you can help me with! Google sheets is great but one of the WORST features that's extremely aggravating is the tool that automatically turns the mouse cursor into a hand when it hovers between cells and then can drag a cell anywhere you want it. This causes lots of mistakes for me if I misclick and then it now drags a cell that I was simply trying to select and now it's moved formulas and deleted stuff. Even worse is that sometimes I don't notice it until later when a formula has stopped working. Please tell me there's a way to disable this function?
 
Upvote 0

Forum statistics

Threads
1,223,214
Messages
6,170,772
Members
452,353
Latest member
strainu

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