需要Excel SUMIF公式 [英] Excel SUMIF formula needed
问题描述
我正在寻找一个SUMIF公式,如果该行符合某个条件,则会将列的所有值相加。标准是需要匹配3类(A,B或C)中的任一种。我的资料如下所示:
I'm looking for a SUMIF formula which adds up all values of a column if the row meets a certain criteria. The criteria is that it needs to match either of the 3 categories (A, B or C). My data looks like this:
A 5 4
B 32 4
B 12 6
B 4 7
A 21 342
C 2 2
C 1 1
A 3 5
A <total A> <total A> etc
B <total B> <total B> etc
C <total C> <total C> etc
公式在水平拖动时应该工作。
The formula should work when dragged horizontally.
提前感谢帮助!
推荐答案
@Mike Meinz给了你正确的答案。公式可以简化如下:
@Mike Meinz gave you the right answer. Formula could be simplified like the following:
在列B总计中,标准A,B和C可以计算如下:
In Column B totals for criteria A, B and C can be calculated as following:
=SUMIF($A1:$A8,"A",$B1:$B8)
=SUMIF($A1:$A8,"B",$B1:$B8)
=SUMIF($A1:$A8,"C",$B1:$B8)
注意:绝对引用($)用于使单元格按照要求水平拖动时保持不变。
Note: absolute reference ($) is used to make the value stay the same if cell is dragged horizontally, as per your requirement.
如果您希望计算单元格拖动后的当前列的总计(而不是固定一个,即本示例中的列B),请修改公式:
In case you would like to calculate the totals of current column after the cell was dragged (rather than fixed one, i.e. column B in this example), modify the formula like:
= SUMIF($ A1:$ A8,A,B1:B8)
=SUMIF($A1:$A8,"A",B1:B8)
相应地,语法可以应用于C列。
请问,
Correspondingly, similar syntax can be applied to Column C. Regards,
这篇关于需要Excel SUMIF公式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!