- ©«¤l
- 1446
- ¥DÃD
- 40
- ºëµØ
- 0
- ¿n¤À
- 1470
- ÂI¦W
- 0
- §@·~¨t²Î
- Windows 7
- ³nÅ骩¥»
- Excel 2010 & 2016
- ¾\ŪÅv
- 50
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥xÆW
- µù¥U®É¶¡
- 2020-7-15
- ³Ì«áµn¿ý
- 2024-10-21
|
¥»©«³Ì«á¥Ñ Andy2483 ©ó 2022-10-31 15:18 ½s¿è
¦^´_ 20# ã´£³¡ªL
ÁÂÁ«e½ú!
¥H¤U¤ß±oµù¸Ñ!½Ð«e½ú¦A«ü¾É!ÁÂÁÂ
Option Explicit
Sub TEST_A1()
Dim Arr, xD, T$, TT$, i&, j%
'¡ô«Å§iÅܼÆ
Set xD = CreateObject("Scripting.Dictionary")
'¡ô¥OxD¬O¦r¨å
Arr = Range([ú®w¶q!e1], [ú®w¶q!y65536].End(3))
'¡ô¥OArr¬O¦r¨å!ˤJ ú®w¶qªí[E1] »PYÄæ³Ì«á-¦³¤º®eÀx¦s®æ¤§¶¡
',³Ì¤p¤è¥¿°Ï°ìÀx¦s®æªºÈ
For i = 2 To UBound(Arr)
'¡ô³]¶¶°j°é!,i±q2 ¨ìArr°}¦C³Ì«á¤@Áa¦V¦C¼Æ
T = Arr(i, 1)
'¡ô¥O¬OArr°}¦C°j°é¦C¼Æ ²Ä1Áa¦VÄæÈ(ªí¸Ìªº¥N¸¹ÄæÈ)
TT = T & "|" & Arr(i, 2)
'¡ô¥OTT¬O ¥N¸¹ & "|" & §å¸¹ ªº²Õ¦X¦r¦ê
xD(TT) = xD(TT) + 1
'¡ô²Õ¦X¦r¦ê·íkey!Item²Ö¥[1
If xD(TT) = 1 Then
'¡ô¦pªG²Õ¦X¦r¦êªºitem ¬O 1®É(TT²Õ¦X¦r¦êè¨ì¤J¦r¨å®É)
xD(T & "/1") = xD(T & "/1") + 1
'¡ô¥O ¥N¸¹ & "/1" ªº²Õ¦X¦r¦ê·íkey!Item²Ö¥[1
'³o¸Ìªº "/1" ¬O¬°¤F«ü¦Vµ²ªG¸ê®ÆªºÄæ¦ì¼Æ1 '@@
'¤]´N¬O¦³¤£¦P²Õ¦X®É ¦P¥N¸¹¥X²{¤£¦P§å¸¹¦¸¼Æ+1
End If
xD(T & "/2") = xD(T & "/2") + Arr(i, 21)
'¡ô¥O ¥N¸¹ & "/2" ªº²Õ¦X¦r¦ê·íkey!Item²Ö¥[Á`¤½¤ç¼Æ
'³o¸Ìªº "/2" ¬O¬°¤F«ü¦Vµ²ªG¸ê®ÆªºÄæ¦ì¼Æ2 '@@
Next
Arr = Range([Analysis!b1], [Analysis!a65536].End(3))
'¡ô«·s¥OArr¬O¦r¨å!ˤJ Analysisªí[B1] »PAÄæ³Ì«á-¦³¤º®eÀx¦s®æ¤§¶¡
',³Ì¤p¤è¥¿°Ï°ìÀx¦s®æªºÈ
For i = 2 To UBound(Arr)
'¡ô³]¥~¶¶°j°é!,i±q2 ¨ìArr°}¦C³Ì«á¤@Áa¦V¦C¼Æ
For j = 1 To 2
'¡ô³]¤º¶¶°j°é!,j±q1 ¨ì2
Arr(i - 1, j) = xD(Arr(i, 1) & "/" & j)
'¡ô¥ÎAnalysisªíªºÃöÁä¦r·f°t"/"²Å¸¹»P¤º¶¶°j°é¼Æ·íKey!
'¬d¦r¨å¸ÌªºitemÈ ¦p¤W¼Ðµù @@³B
'±Nµ²ªGitemÈ©ñ¦bÃöÁä¦r¦C«e¤@¦C°j°é¹ïÀ³Äæ¸Ì!
'¦]¬°«á¤è ##¼Ð¥Ü³B¦³ -1,©Ò¥H¤£·|¾ÉPArr³Ì«á¦C¶K¤Jµ²ªG!
Next
Next
[Analysis!b2].Resize(UBound(Arr) - 1, 2) = Arr '##
'±NArr°}¦C±qAnalysisªí[B2]¶}©l¶K¤J!
'¦]¬°Resize()= Arrªº¤è¦¡¬Oª½±µ³Ì¥ª¤W¨¤½d³òªºªº¤¸¯À!
'©Ò¥H«e½ú¤~±qArr²Ä¤@¦C¶}©l±a¤Jµ²ªG
'¦pªG¬O«á¾Ç¬°¤F«OÀI°_¨£!·|¥[ÓBrr¨Ó¸Ëµ²ªG!
'ÁÂÁ«ü¾É!
End Sub |
|