jkupczak
jkupczak

Reputation: 3051

In Excel can I write a formula that will calculate the sum of a column based on the contents of another column?

In Excel can I write a formula that will calculate the sum of a column based on the contents of another column? In the example below, the formula would output '12' if I wanted to see all sales with a category of 'Email'.

This was my idea, but it doesn't work.

=SUMIF(table1[Sales],AND(table1[Category]="Email",table1[Subcategory]="Content"))

A       | B         | C
-----------------------------------
Sales   | Category  | Subcategory
===================================
10      | Email     | Content
-----------------------------------
5       | Web       | Non-Content
-----------------------------------
2       | Email     | Content

Upvotes: 0

Views: 47

Answers (1)

Scott Craner
Scott Craner

Reputation: 152650

You want SUMIFS() with an S:

=SUMIFS(table1[Sales],table1[Category],"Email",table1[Subcategory],"Content")

Criteria are always done in twos:

  • A range the same size as the one being summed
  • The criteria as a string(= being the default)

You can add others or only have one:

=SUMIFS(table1[Sales],table1[Category],"Email")

Which does the same as SUMIF() with slightly different order of criteria.

Upvotes: 1

Related Questions