0

Is there a function that allows me to calculate the total value of column B if column A is equal to "some text". I'm making a budget for myself.

Currently, my Google Spreadsheet looks something like this:

----A---- -----B----    
     food         50
  alcohol         20
     food        120
    dance         10
   garden         20
     food         20
    dance         10

I would like to get the total amounts like this:

----E---- -----E---- 
     food        190
  alcohol         20
    dance         20
   garden         20

I can use an if statement on a single cell but how do I do it over several cells and SUM values together? So the if statement would be =if(A1="food",B1,0)

4

2 回答 2

0

您可以使用 SUMIF

=SUMIF(range to be matched, criteria,sum range)

在你的情况下,它会是

=SUMIF($A$1:$A$7,E1,$B$1:$B$7)

假设A1:A7是“食物,alochal,舞蹈等) E1是食物(标准)并且B1:B7是数字(总和范围)

于 2013-09-11T09:35:56.277 回答
0

一种选择是使用函数:QUERY。

=QUERY(A1:B7; "SELECT A, SUM(B) GROUP BY A LABEL A '', SUM(B) ''")

询问

更多信息:查询语言参考

于 2013-09-11T14:00:45.797 回答