恐怕没有比我这个公式更长的啦,一篇小论文的长度,哈哈——- =SUM(OFFSET(A31,1-SMALL(MATCH(ROW(1:10)-1,N(OFFSET(A31,1-ROW(1:30),)),0),7),,SUM(SMALL(MATCH(ROW(1:10)-1,N(OFFSET(A31,1-ROW(1:30),)),0),{7,8})*{1,-1})))+SUM(OFFSET(B31,1-SMALL(MATCH(ROW(1:10)-1,N(OFFSET(B31,1-ROW(1:30),)),0),7),,SUM(SMALL(MATCH(ROW(1:10)-1,N(OFFSET(B31,1-ROW(1:30),)),0),{7,8})*{1,-1})))+SUM(OFFSET(C31,1-SMALL(MATCH(ROW(1:10)-1,N(OFFSET(C31,1-ROW(1:30),)),0),7),,SUM(SMALL(MATCH(ROW(1:10)-1,N(OFFSET(C31,1-ROW(1:30),)),0),{7,8})*{1,-1})))+SUM(OFFSET(D31,1-SMALL(MATCH(ROW(1:10)-1,N(OFFSET(D31,1-ROW(1:30),)),0),7),,SUM(SMALL(MATCH(ROW(1:10)-1,N(OFFSET(D31,1-ROW(1:30),)),0),{7,8})*{1,-1})))+SUM(OFFSET(E31,1-SMALL(MATCH(ROW(1:10)-1,N(OFFSET(E31,1-ROW(1:30),)),0),7),,SUM(SMALL(MATCH(ROW(1:10)-1,N(OFFSET(E31,1-ROW(1:30),)),0),{7,8})*{1,-1})))+SUM(OFFSET(F31,1-SMALL(MATCH(ROW(1:10)-1,N(OFFSET(F31,1-ROW(1:30),)),0),7),,SUM(SMALL(MATCH(ROW(1:10)-1,N(OFFSET(F31,1-ROW(1:30),)),0),{7,8})*{1,-1})))+SUM(OFFSET(G31,1-SMALL(MATCH(ROW(1:10)-1,N(OFFSET(G31,1-ROW(1:30),)),0),7),,SUM(SMALL(MATCH(ROW(1:10)-1,N(OFFSET(G31,1-ROW(1:30),)),0),{7,8})*{1,-1})))
复制代码 我的数组思维已经僵化了,很期待版主108字符的。
即便是用VBA写,精简到最后也要190个字符的代码——- Function z(r)
- Dim a, s, i, j
- a = r
- For i = 1 To 7
- s = "0123456789"
- For j = 30 To 1 Step -1
- s = Replace(s, a(j, i), “”)
- If Len(s) = 3 Then z = z + a(j, i)
- Next
- Next
- End Function
复制代码 |