14

I have set up a form with Google Spreadsheet where I want to collect grocery expenses for different people. How can I sum the expenses for different persons? Each row has a column with the person's name and the amount spent.

Let me give an example for the problem:

Table:

A      B
Name Amount
Me    1 
You   2
Me    3
Me    4
You   5

I want to SUM column B where column A = "Me" so the result is 8.

2 Answers 2

19

You can use the SUMIF function to calculate the total sum for each person.

If you enter the following formula in a cell you like, it will give you the total amount spent by "Me":

=SUMIF(A2:A6,"=Me",B2:B6)

where A2:A6 is the Range, "=Me" is the Criteria, and B2:B6 is the Sum_Range.

3
  • Here's how to get a list of available functions
    – none
    Feb 23, 2011 at 7:50
  • 1
    For this to work in non-US locales you need to use ";" instead of "," in the statement above. Otherwise you'll get an "#ERROR!". Feb 20, 2013 at 9:27
  • @EmilStenström: True. I have Turkish locale and I always use ; in Excel formulas. Additionally, if you work with macros in Excel, you always have to use , for formulas in your code even if you have non-US locales. Feb 20, 2013 at 20:10
1

Since the expenses are for different people I would suggest a pivot table so not only is Me summed but so are all other people, and a control total created automatically.

Data > Pivot table... , Add Name to Rows and Amount to Values as Summarise by SUM:

WA12721 example

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.