开发者

Excel : sum of values depending of other values

What would be the equivalent Excel formula of this SQL query

SELECT SUM(a) FROM table WHERE b < 0;

A     B
----  ----
   1     0
   2    -1 
   3     4
   5    -3

>> 开发者_如何学Python7


Use the SUMIF function.


=SUMIF(B:B,"<0",A:A)


use SUMIFS(a1:a4,b1:b4,"<0") if values in A1:B4 range


Given:

Row#    A    B

3       1    0
4       2   -1
5       3    4
6       5   -3

=SUMIF(B3:B6; "<0"; A3:A6)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜