|
本帖最后由 mjm04 于 2024-9-17 23:55 编辑
参与一下下
如果 9月份日期全部都有,无遗漏并且升序排列的话,2楼公式可以简写为:
=SUM(OFFSET($A$1,6,1,(G2-F2+1)))
================================================
不考虑日期排列方式 ,公式还可以写作以下几种
最好理解
=SUM((DAY($A$2:$A$31)>=$F2)*((DAY($A$2:$A$31)<=$G2))*$B$2:$B$31)
或
=SUMPRODUCT((DAY($A$2:$A$31)>=$F2)*((DAY($A$2:$A$31)<=$G2))*$B$2:$B$31)
如果有FILTER函数
=SUM(FILTER($B$2:$B$31,(DAY($A$2:$A$31)>=$F2)*((DAY($A$2:$A$31)<=$G2))))
****************************************************************
以下都是练手用的呢,借楼练习,需要下拉,匆怪匆怪
没苦硬吃的
=SUM(MMULT((DAY($A$2:$A$31)>=$F2)*((DAY($A$2:$A$31)<=$G2))*$B$2:$B$31,1))
=BYCOL(FILTER($B$2:$B$31,(DAY($A$2:$A$31)>=$F2)*((DAY($A$2:$A$31)<=$G2))),SUM)
=LET(_a,HSTACK(DAY($A$2:$A$31),$B$2:$B$31),_a1,CHOOSECOLS(_a,1),_a2,CHOOSECOLS(_a,2),SUM((_a1>=F2)*(_a1<=G2)*_a2))
神经病 写法的
=SUM(DROP(GROUPBY($B$2:$B$31,$B$2:$B$31,SUM,2,0,,(DAY($A$2:$A$31)>=$F2)*((DAY($A$2:$A$31)<=$G2))),1,1))
|
|