Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to sum up categories in Excel

Tags:

excel

grouping

I am new to Excel and have a question.

I have a set of columns as follows:

Amount  Category
10  A
15  A
20  B
25  B
15  A

And I need to sum it up and get the following result:

Category    
A   40
B   45

Thank you for your help in advance!

like image 758
serverman Avatar asked Jun 18 '16 15:06

serverman


4 Answers

Another option, if you will be doing this repeatedly and might have a larger number of categories, would be a Pivot Table. Select your range, or a single cell in the range, then

Insert ► Pivot Table

Drag Category to the Rows area; Amount to the Values area; format to taste:

enter image description here

like image 96
Ron Rosenfeld Avatar answered Oct 23 '22 15:10

Ron Rosenfeld


if your first table and second table are set in worksheets named table1 and table2, then write the formula below in B2 cell in table2

=sumifs(table1!A:A, table1!B:B, A2)

like image 27
PaichengWu Avatar answered Oct 23 '22 16:10

PaichengWu


OK - Found the answer:

=SUMIF(D4:D8, "A", C4:C8)
like image 3
serverman Avatar answered Oct 23 '22 15:10

serverman


In Excel 2013 there will be a "grouping" option.

  1. Select your table.
  2. Go to the Data tab.
  3. Click Structure > Grouping.

Then you can apply the sum function.

Alternatively, you can use Subtotal

You can also do this with the Subtotal feature.

  1. Select Data tab
  2. Click the Sort button and sort by category
  3. Click the Subtotal button
like image 3
woodykiddy Avatar answered Oct 23 '22 14:10

woodykiddy