Sum cells in a column that have a specific value in a cell in their row

Travis L picture Travis L · Sep 18, 2012 · Viewed 34.2k times · Source

My table is as follows...

Timestamp | Category   | Cost 
--------------------------------
...       | Shopping   | 5
...       | Charity    | 10
...       | Dining     | 20
...       | Mortgage   | 1000
...       | Dining     | 30
etc...

What I need is a formula for each category value that will get the sum of the cost column for rows that have that category. ie. total spending in that category that I can place in the "actual spending" cell in my budget table. The data is input with a google form so I have almost no power over formatting.

Thanks for your help!

Answer

T0t3sMcG0t3s picture T0t3sMcG0t3s · Sep 18, 2012

You could use multiple SUMIF() functions to place these sums anywhere in the spreadsheet. Assuming Column A is TimeStamp, Column B is Category, and Column C is Cost:

Shopping -> =SUMIF(B:B, "Shopping", C:C)
Charity  -> =SUMIF(B:B, "Charity", C:C)
Dining   -> =SUMIF(B:B, "Dining", C:C)
Mortgage -> =SUMIF(B:B, "Mortgage", C:C)