excel里怎么从众多数字中相加,找出最接近已知和的三个数字?有没有公式?
excel里怎么从众多数字中相加,找出最接近已知和的三个数字?有没有公式?
日期:2014-04-02 10:45:01 人气:1
用VBA写自定义函数,代码如下。
用法形式:=res($F$2:$F$10,$F$12:$F$20,$F$22:$F$40,10804)
Function res(r1 As Range, r2 As Range, r3 As Range, c As Single)tmp = 10 ^ 10For i = 1 To r1.CountFor j = 1 To r2.CountFor k = 1 To r3.Counttmp1 = Abs(r1(i, 1) + r2(j, 1) + r3(k, 1) - c)