excel 中,包含的函数
发布网友
发布时间:2022-04-23 19:23
我来回答
共1个回答
热心网友
时间:2023-10-07 14:51
用函数来做很难,给个宏吧,试用一下,本人在Excel
2003中调试正常。
Sub
FF()
Dim
X,
I
As
Long
Dim
A(),
B(),
C(),
J,
K,
L,
AA,
B1,
C1,
T
As
Integer
X
=
Range("A65536").End(xlUp).Row
B1
=
(Len(Cells(1,
2))
+
1)
/
3
ReDim
B(1
To
B1)
For
L
=
1
To
B1
B(L)
=
Val(Mid(Cells(1,
2),
3
*
L
-
2,
2))
M
=
M
+
1
Next
L
C1
=
(Len(Cells(1,
3))
+
1)
/
3
ReDim
C(1
To
C1)
For
L
=
1
To
C1
C(L)
=
Val(Mid(Cells(1,
3),
3
*
L
-
2,
2))
Next
L
For
I
=
2
To
X
AA
=
(Len(Cells(I,
1))
+
1)
/
3
ReDim
A(1
To
AA)
For
L
=
1
To
AA
A(L)
=
Val(Mid(Cells(I,
1),
3
*
L
-
2,
2))
Next
L
T
=
0
For
J
=
1
To
AA
For
K
=
1
To
B1
If
A(J)
=
B(K)
Then
T
=
T
+
1
Next
K
Next
J
If
T
>
3
Then
Cells(I,
2)
=
"超过3个"
Else
Cells(I,
2)
=
Cells(I,
1)
End
If
T
=
0
For
J
=
1
To
AA
For
K
=
1
To
C1
If
A(J)
=
C(K)
Then
T
=
T
+
1
Next
K
Next
J
If
T
>
4
Then
Cells(I,
3)
=
"超过4个"
Else
Cells(I,
3)
=
Cells(I,
1)
End
If
Next
I
End
Sub