6

有没有办法将行/列中的所有正数相加但忽略所有负数?与 SUM() 类似,只是它忽略了负数。我必须使用VBA吗?如果是这样,我将如何在 VBA 中做到这一点?

如果不能在 Excel 中完成,是否可以在 OpenOffice Calc 中完成?

4

7 回答 7

16

使用 SUMIF。Y 将 A 列中的所有正数相加:

=SUMIF(A:A,">0")

Excel和Calc中存在相同的功能

于 2009-10-20T19:21:16.167 回答
0
=SUMIF(A1:A99,">0")
于 2009-10-20T19:21:23.680 回答
0

肯定是这样的:

=SUMIF(B1:B50,">0")

这会将单元格 B1 到 B50 中的所有正数相加。

于 2009-10-20T19:21:24.013 回答
0

=SUMIF(A1:A4,">=0")

于 2009-10-20T19:21:38.263 回答
0

SUMIF() 可以解决问题:

 =SUMIF(A1:A100,">0")

您也可以使用数组公式,但这更复杂,并且与 SUMIF() 相比没有任何好处

于 2009-10-20T19:21:48.163 回答
0

获取辅助行/列,如有必要,在另一个选项卡中使用 =if(A5>0;A5;0) 填充它们。这将使负数为零。然后总结这些。

于 2009-10-20T19:25:16.173 回答
-2

I am an excel noob...and after an hour or so of wondering what I am doing wrong and why wont it work for me, I realize how important each symbol is. this formula should have a semicolon instead of comma. Once I changed that the formula didn't give me any errors =sumif(A:A;">0") hope this helps

于 2013-05-31T22:08:10.167 回答