Sum Values based on Column Value

Elliot76

New Member
Joined
Jan 3, 2024
Messages
4
Office Version
  1. 365
Platform
  1. Windows
Hey All,

I am trying to sum together values in a column based on a string value in column A.
I have something similar to the table below and wish group together the strings in column A and sum the values in column B to give me a combined table.

Input:

Column AColumn B
TestA5
TestA1
TestA3
TestB1
TestB2
TestC5

Result (trying to build)

Column AColumn B
TestA9
TestB3
TestC5
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
Try This


Excel Formula:
=HSTACK(UNIQUE($A$2:$A$7),SUMIF($A$2:$A$7,UNIQUE(A2:A7),B2:B7))2


1704273454705.png
 

Attachments

  • 1704273405996.png
    1704273405996.png
    38.2 KB · Views: 2
Upvote 0
Sorry, should have stated that I would like to write this as a macro so the user has a button to press on the main worksheet!
Which row do you want to put the results of the macro in?
 
Upvote 0
UPDATE:
I now have 2 columns I wish to check to give me a summed table as per the below:

I need to find the unique values within Columns A & C and sum column D to give me a final result.

Input:

FFIAT Fund Import TEST.xlsm
QRST
1ColumnAColumn BColumnCColumnD
2TestAgfdghello1
3TestAfgbvhello2
4TestAbthello3
5TestAbvworld4
6TestAfbworld5
7TestAworld6
8TestBrbvhello1
9TestBbworld1
10TestBbvnfworld2
11TestCvchello1
12TestChfdhello2
13TestCgfdghello3
14TestCsdfgworld4
Test


Output:

FFIAT Fund Import TEST.xlsm
UVW
1ColumnAColumnBColumnC
2TestAhello6
3TestAworld15
4TestBhello1
5TestBworld3
6TestChello6
7TestCworld4
Test
 
Upvote 0
Welcome to the MrExcel Message Board!

Cross-posting (posting the same question in more than one forum) is not against our rules, but the method of doing so is covered by #13 of the Forum Rules.

Be sure to follow & read the link at the end of the rule too!

Cross posted at: Sum column based on multiple criteria
There is no need to repeat the link(s) provided above but if you have posted the question at other places, please provide links to those as well.

If you do cross-post in the future and also provide links, then there shouldn’t be a problem.
 
Upvote 0

Forum statistics

Threads
1,215,084
Messages
6,123,029
Members
449,092
Latest member
ikke

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