- ©«¤l
- 1447
- ¥DÃD
- 40
- ºëµØ
- 0
- ¿n¤À
- 1471
- ÂI¦W
- 0
- §@·~¨t²Î
- Windows 7
- ³nÅ骩¥»
- Excel 2010 & 2016
- ¾\ŪÅv
- 50
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥xÆW
- µù¥U®É¶¡
- 2020-7-15
- ³Ì«áµn¿ý
- 2024-12-5
|
¦^´_ 7# ã´£³¡ªL
ÁÂÁ½׾Â,ÁÂÁ«e½ú
«á¾ÇÂǦ¹©«¾Ç²ß«e½úªº¤è®×,«á¾Ç¾Ç²ß¤ß±oµù¸Ñ¦p¤U,½Ð«e½ú¦A«ü¾É
°õ¦æµ²ªG:
Public Const R = 1000
Sub ¨ú¼Æ3()
Dim i&, j&, Arr, Brr, Drr, T, SS, xD, xD1, TT$, M%, N%, Y$
'¡ô«Å§iÅܼÆ
T = Timer
[B:B].ClearContents: [H3:H4] = ""
'¡ô²M°£µ²ªGÄæ¸ê®Æ
Arr = [A1].Resize(R): Brr = [B1].Resize(R): Drr = [D1].Resize(R)
'¡ô¥O(Arr,Brr,Drr)¦U¬O¤Gºû°}¦C±a¤JÀx¦s®æÈ
Set xD = CreateObject("Scripting.Dictionary")
Set xD1 = CreateObject("Scripting.Dictionary")
'¡ô¥O(xD,xD1)¦U¬O¦r¨å
For j = 1 To UBound(Drr)
'¡ô³]¶¶°j°é
TT = Drr(j, 1)
'¡ô¥OTTÅܼƬO °j°éDrr°}¦CÈ
M = Len(TT)
'¡ô¥OMÅܼƬO TTÅܼƪº¦r¼Æ
N = 1
'¡ô¥ONÅܼƬO 1
xD1.RemoveAll
'¡ô¥O²MªÅ xD1¦r¨å
Do
'¡ô³]±ø¥ó°j°é
For i = 1 To M
'¡ô³]¶¶°j°é
Y = Mid(TT, N, i)
'¡ô¥OY¬O TTÅܼƱq ²Ä1¦r¶}©l¨ú¥k°¼ªº¦r
If xD1(Y) = "" Then xD(Y) = xD(Y) + 1
'¡ô¦pªGxD1¦r¨å¸Ì¨S¦³YÅܼƳokey,´N¥OxD¦r¨å¯Ç¤J,item²Ö¥[1
xD1(Y) = 1
'¡ô¥OYÅܼƯǤJxD1¦r¨å¸Ì,item¬O 1,ÅýxD1¦r¨å¦b¤U¦¸²MªÅ«eÂo«½Æ
Next i
N = N + 1: M = M - 1
'¡ôN.MÅܼưµÅܤÆ,¥H¥þ³¡¤å¦r¦ê²Õ¦X³v¦¸Â^¨ú
Loop Until M = 0
'¡ô°õ¦æ¨ì ³Ì«á¤@Ó¦r¤¸
Next j
For i = 1 To UBound(Arr)
'¡ô³]¶¶°j°é
Y = Arr(i, 1): j = xD(Y)
'¡ô¥HArr°}¦CȬdxD¦r¨å¦^¶ÇitemÈ(¸Ókey¥X²{¹L´X¦¸)
Brr(i, 1) = j
'¡ô¼g¤JBrr°}¦C
SS = SS + j
'¡ô²Öp¦¸¼Æ
Next i
[B1].Resize(R) = Brr: [H3] = Timer - T: [H4] = SS
End Sub |
|