如果其他两列的差异小于 0 并且满足其他条件,则对列中的值求和

Sum values in column if the difference of two other columns is smaller than 0 and an additional critieria is met

  |      A      |      B     |        C        |          D           |     E       |
--|-------------|------------|-----------------|----------------------|-------------|-
1 |  Product    | sales_plan |  sales_actuals  |  purchase_quantity   |             |
2 |  Product_A  |     500    |       400       |         1200         |   Product_B |
3 |  Product_B  |     800    |       900       |         3000         |     5000    |
4 |  Product_B  |     300    |       490       |         2000         |             |
5 |  Product_D  |     900    |       820       |         7000         |             |
6 |  Product_D  |     200    |       250       |         5000         |             |
7 |  Product_D  |     700    |       600       |         4000         |             |

参考中的答案在Cell E3中我想总结一下 purchase_quantityColumn D

a) 如果 sales_actuals > sales_plan
b) 如果产品与 Cell E2 中的条目匹配。

我尝试使用这个公式,但无法使其工作:

=SUMPRODUCT((C2:C7>B2:B7)*D2:D7;A2:A7=E2)

我需要如何修改它才能获得正确的值?

正如您在评论中看到的那样,JvdV 的回答是有效的:

=SUMPRODUCT((C2:C7>B2:B7)*(A2:A7=E2)*D2:D7)