Summing with condition and loop

bestnagi

New Member
Joined
Mar 12, 2013
Messages
14
I have an excel sheet with 3 columns.
Column1 is ClientName, column2 is Desrciption , column 3 is a number corresponding to the description.
I need to sum the numbers corresponding to each description of ClienName using filters or for loop.

In other words:

<code style="margin: 0px; padding: 0px; border: 0px; vertical-align: baseline; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif;">col1 col2 col3
Jason Cash 20
Jason Cash 30
Jason Cash 10
Jason Credit 20
Jason Credit 40
John Cash 20
John Cash 10
John Credit 30
John Credit 20
Mary Cash 50
Mary Cash 20
Mary Credit 20
Mary Credit 100
Mary Credit 200
</code>
I need results like that


<code style="margin: 0px; padding: 0px; border: 0px; vertical-align: baseline; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif;">Jason CashTotal CreditTotal
John CashTotal CreditTotal
Mary CashTotal CreditTotal
</code>
How can this be done in Excel?
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
F2 = Jason G2 = Cash
H2 =SUMPRODUCT(--($A$2:$A$15=F2),--($B$2:$B$15=G2),$C$2:$C$15)
and list other conditions under coloumn F and G
 
Upvote 0
Welcome to the forum, you could use either SUMIFS or SUMPRODUCT dependant on the version of Excel you are using, the sample below is using SUMPRODUCT

Excel Workbook
ABCDEFG
1col1col2col3CashCredit
2JasonCash20Jason6060
3JasonCash30Jason6060
4JasonCash10John3050
5JasonCredit20Mary70320
6JasonCredit40
7JohnCash20
8JohnCash10
9JohnCredit30
10JohnCredit20
11MaryCash50
12MaryCash20
13MaryCredit20
14MaryCredit100
15MaryCredit200
Sheet2
 
Upvote 0
F2 = Jason
F3 = John
F4 = Mary
Code:
G2 (copied down) =SUMIFS($C$2:$C$15,$A$2:$A$15,$F2,$B$2:$B$15,"Cash")
H2 (copied down) =SUMIFS($C$2:$C$15,$A$2:$A$15,$F2,$B$2:$B$15,"Credit")
 
Upvote 0

Forum statistics

Threads
1,214,929
Messages
6,122,314
Members
449,081
Latest member
tanurai

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