求Excel任意几个个数字4个组合排列与3个一组排列组合公式
Function朱科技(zhuAsRange,numAsInteger)R=zhu.Rows.CountForC1=1ToRForC2=C1+1ToRForC3=C2+1...
Function 朱科技(zhu As Range, num As Integer)
R = zhu.Rows.Count
For C1 = 1 To R
For C2 = C1 + 1 To R
For C3 = C2 + 1 To R
For C4 = C3 + 1 To R
rr = rr + 1
朱科技 = zhu(C1, 1) & "," & zhu(C2, 1) & "," & zhu(C3, 1) & "," & zhu(C4, 1)
If rr = num Then Exit Function
Next
Next
Next
Next
End Function
在任意单元格中输入公式下拉即可自行排列出所有组合
=朱科技($A$1:$A$15,ROW(A1))
你好,按照此公式跳转到第5列,应该是2134,1不再循环,公式有误,
看了好多书,感觉不解,请帮忙修改 展开
R = zhu.Rows.Count
For C1 = 1 To R
For C2 = C1 + 1 To R
For C3 = C2 + 1 To R
For C4 = C3 + 1 To R
rr = rr + 1
朱科技 = zhu(C1, 1) & "," & zhu(C2, 1) & "," & zhu(C3, 1) & "," & zhu(C4, 1)
If rr = num Then Exit Function
Next
Next
Next
Next
End Function
在任意单元格中输入公式下拉即可自行排列出所有组合
=朱科技($A$1:$A$15,ROW(A1))
你好,按照此公式跳转到第5列,应该是2134,1不再循环,公式有误,
看了好多书,感觉不解,请帮忙修改 展开
展开全部
Function 朱科技(zhu As Range, num As Integer)
r = zhu.Rows.Count
For c1 = 1 To r
For c2 = 1 To r
If c2 <> c1 Then
For c3 = 1 To r
If c3 <> c1 And c3 <> c2 Then
For c4 = 1 To r
If c4 <> c1 And c4 <> c2 And c4 <> c3 Then
rr = rr + 1
朱科技 = zhu(c1, 1) & "," & zhu(c2, 1) & "," & zhu(c3, 1) & "," & zhu(c4, 1)
If rr = num Then Exit Function
End If
Next
End If
Next
End If
Next
Next
End Function
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询