SUMPRODUCT获得+1行 [英] SUMPRODUCT to get row +1

查看:75
本文介绍了SUMPRODUCT获得+1行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个如下表:

12/7/2012   A   B   
                     100    

12/21/2012  A   I   
                     20

12/23/2012  A   I   
                     25     

12/1/2013   A   I   
                     20     

12/1/2014   A   I   
                     20

我想获取D列中的值,其中B列为"A",C列为"I".我使用sumsum来获取D列中的值,但是我需要从B列为"A"和C列为"I"的位置向下移1行.这是我的公式:

I want to get the value in column D where column B is "A" and column C is "I". I used a sumproduct to get the value in column D, but I need to go down 1 row from wherever column B is "A" and column C is "I". This is my formula:

=SUMPRODUCT(--(B:B="A"),--(C:C="I"),F:F+1). 

应返回值85,但应返回值4.

It should return a value of 85, but it returns a value of 4.

推荐答案

您可以使用

=SUM((B1:B10="A")*(C1:C10="I")*(D2:D11))

作为带有 Ctrl Shift Enter

=SUMPRODUCT(--(B1:B10="A"),--(C1:C10="I"),(D2:D11))

并根据需要扩展范围.

您的公式会发生什么

=SUMPRODUCT(--(B:B="A"),--(C:C="I"),D:D+1)

是它仅向D列中的每一行添加一个.D1,D3,D5和D7是空单元格,因此计为零.因此,对于四个匹配的行,它会将总数加一,结果为4.

is that it is just adding one to each row in column D. D1, D3, D5 and D7 are empty cells so count as zero. So for the four matching rows it is adding one to the total and the result is 4.

这篇关于SUMPRODUCT获得+1行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆