开发者

Excel : sum of values depending of other values

开发者 https://www.devze.com 2023-01-01 19:51 出处:网络
What would be the equivalent Excel formula of this SQL query SELECT SUM(a) FROM table WHERE b < 0; AB

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

精彩评论

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