以下是引用luo159在2006-11-24 16:11:36的发言: 能否解释一下替换IF之公式中哪一个计算最快? 別人帮我测试过速度。 关於这18个条件公式,用VBA公式, 每公式反覆重箅100,000次数, 速度为秒, 名次如下, 以作参考之用 :
名次 速度 公式 1] 2.09 =SMALL({500;800;1100;1400;1700},COUNTIF($A$9:$A$13,"<="&A1)) 2] 2.11 =INDEX({500;800;1100;1400;1700},COUNTIF($A$9:$A$13,"<="&A1)) 3] 2.14 =CHOOSE(COUNTIF($A$9:$A$13,"<="&A1),500,800,1100,1400,1700) 4] 4.58 =LOOKUP(A1,{0,10,20,30,40},{500,800,1100,1400,1700}) 5] 4.66 =MIN(4,INT(A1/10))*300+500 6] 4.70 =MATCH(A1,{0,10,20,30,40})*300+200 7] 5.00 =MIN(40,FLOOR(A1,10))*30+500 8] 5.02 =HLOOKUP(A1,{0,10,20,30,40;500,800,1100,1400,1700},2,1) 9] 6.02 =200+SUM((A1>={0;10;20;30;40})*300) 10] 6.06 =FREQUENCY({0,10,20,30,40},A1)*300+200 11] 6.17 =MAX((A1>={0,10,20,30,40})*{500,800,1100,1400,1700}) 12] 6.23 =INDEX({500;800;1100;1400;1700},MATCH(A1,{0;10;20;30;40},1)) 13] 6.69 =CHOOSE(MATCH(A1,{0;10;20;30;40},1),500,800,1100,1400,1700) 14] 6.80 =500+SUM(IF(A1>={10,20,30,40},{300,300,300,300})) 15] 6.80 =IF(A1<10,500,IF(A1<20,800,IF(A1<30,1100,IF(A1<40,1400,1700)))) 16] 7.91 =CHOOSE(SUM((A1>={0;10;20;30;40})*1),500,800,1100,1400,1700) 17] 9.36 =MAX((INT(A1/({10;20;30;40}))>0)*(ROW($1:$4)*300))+500 18] 9.44 =CHOOSE(MIN(INT(A1/(ROW($1:$4)*10))+1,5),500,800,1100,1400,1700) |