|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
我觉得这段代码挺有意思的
=SUMPRODUCT((INDIRECT(spd1A)=J$3)*(INDIRECT(spd1B)=List!$C11)*(INDIRECT(spd1F)))
其中 自定义 spd1A="Spend1!$A$3:$A$"&IF((2+COUNTA(Spend1!$F$3:$F$65535))<=3,3,2+COUNTA(Spend1!$F$3:$F$65535))
spd1B="Spend1!$B$3:$B$"&IF((2+COUNTA(Spend1!$F$3:$F$65535))<=3,3,2+COUNTA(Spend1!$F$3:$F$65535))
spd1F ="Spend1!$F$3:$F$"&IF((2+COUNTA(Spend1!$F$3:$F$65535))<=3,3,2+COUNTA(Spend1!$F$3:$F$65535))
分解代码: spd1A="Spend1!$A$3:$A$"&IF((2+COUNTA(Spend1!$F$3:$F$65535))<=3,3,2+COUNTA(Spend1!$F$3:$F$65535))
spd1A="Spend1!$A$3:$A$" &(NUM) 最终形成 自定义Spend1!$A$3:$A$n
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
写法:好处,可以不用=offset(Spend1!$F$3,0,0,counta(Spend1!$F$3,$F$65535)) 生成 Spend1!$F$3:$F$n ,执行效率加快超多。
缺陷,"Spend1!$A$3:$A$"要进行手动修改,挺花时间的。
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
=SUMPRODUCT((INDIRECT(spd1A)=J$3)*(INDIRECT(spd1B)=List!$C11)*(INDIRECT(spd1F)))
=SUMPRODUCT((INDIRECT("Spend1!$A$3:$A$n")=J$3)*(INDIRECT("Spend1!$B$3:$B$n")=List!$C11)*(INDIRECT("Spend1!$F$3:$F$n")))
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
[ 本帖最后由 猪的无赖 于 2011-2-12 16:53 编辑 ] |
|