两种条件下求和

Sum under two conditions

假设以下两列:

Close 1   Close 2
.28       .90
.26      .87
.34       .16
7.06     4.70
.68       .55
.57      .51
.76      .82
.60       .18
.15       .09

这是我的数据库的一部分。假设 Close 1 是 1 月 1 日的收盘价,Close 2 是 1 月 2 日的收盘价。上面 table 中的每一行都是不同的股票。我知道如何用

对每一行求和 (Close 2 - Close 1)/Close 1
=SUM(ARRAYFORMULA(Database!$N:$N-Database!$L:$L)/Database!$L:$L))

我只想在特定条件下求和。我想做两个总和,第一个只考虑 (Close 2 - Close 1)/Close 1 小于 0 的行,第二个 (Close 2 - Close 1)/Close 1 大于或等于 0。我该怎么做?

I would like to make two sums where the first one will only consider the row where (Close 2 - Close 1)/Close 1 is less than 0

否定:

=SUM(ARRAYFORMULA(QUERY(IFERROR((A2:A-B2:B)/A2:A), 
 "where Col1 contains '-'", 0)))

and the second one where (Close 2 - Close 1)/Close 1 is greater or equal to 0

正面:

=SUM(ARRAYFORMULA(QUERY(IFERROR((A2:A-B2:B)/A2:A), 
 "where not Col1 contains '-'", 0)))