Calculate sum in a column based on a condition in another column

Tejas Kore

Board Regular
Joined
Nov 2, 2017
Messages
72
Office Version
  1. 365
Platform
  1. Windows
Hello Friends,
I want to find sum in a column based on the criteria in another column. Here is a sample data:
A B
ABC 2
ABC 2
DEF 3
DEF 3
DEF 3

I want output like. How can this be achieved using excel formula:

ABC 4
DEF 9
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
For this one, it's helpful to know your version of excel. For 365.
MrExcelPlayground2.xlsm
ABCDE
1ABC2ABC4
2ABC2DEF9
3DEF3
4DEF3
5DEF3
Sheet36
Cell Formulas
RangeFormula
D1:D2D1=UNIQUE(A1:A5)
E1:E2E1=SUMIFS($B$1:$B$5,$A$1:$A$5,D1)
Dynamic array formulas.


For older versions,
MrExcelPlayground2.xlsm
ABCDE
11ABC2ABC4
12ABC2DEF9
13DEF3
14DEF3
15DEF3
Sheet36
Cell Formulas
RangeFormula
E11:E12E11=SUMPRODUCT($B$11:$B$15,--($A$11:$A$15=D11))


You might have sumifS, but not unique, so mix and match...
 
Upvote 0
Solution
For this one, it's helpful to know your version of excel. For 365.
MrExcelPlayground2.xlsm
ABCDE
1ABC2ABC4
2ABC2DEF9
3DEF3
4DEF3
5DEF3
Sheet36
Cell Formulas
RangeFormula
D1:D2D1=UNIQUE(A1:A5)
E1:E2E1=SUMIFS($B$1:$B$5,$A$1:$A$5,D1)
Dynamic array formulas.


For older versions,
MrExcelPlayground2.xlsm
ABCDE
11ABC2ABC4
12ABC2DEF9
13DEF3
14DEF3
15DEF3
Sheet36
Cell Formulas
RangeFormula
E11:E12E11=SUMPRODUCT($B$11:$B$15,--($A$11:$A$15=D11))


You might have sumifS, but not unique, so mix and match...
I have Microsoft® Excel® for Microsoft 365 MSO (16.0.14026.20202) 32-bit . The first solution ran seamlessly !!
 
Upvote 0
I have Microsoft® Excel® for Microsoft 365 MSO (16.0.14026.20202) 32-bit . The first solution ran seamlessly !!

I would suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)
 
Upvote 0

Forum statistics

Threads
1,214,593
Messages
6,120,434
Members
448,961
Latest member
nzskater

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