ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

[µo°Ý] ¦p¦ó²¾°£°}¦C¤º­«½Æªº³¡¤À(STRING)

[µo°Ý] ¦p¦ó²¾°£°}¦C¤º­«½Æªº³¡¤À(STRING)

MyArray() ="XX","aa","ab",XX","ab"
¦p¦ó¥i¨ú±o"XX","aa","ab"ªº­È©O(¤£­«½Æ)
PKKO

¦^´_ 20# ML089

ÁÂÁ«e½ú«ü¾É
«á¾Ç³Ìªñ¾Ç²ß¦r¨å»P°}¦C,¦³¬ÝÀ´«e½úªº«ü¾É!
«Ü¦½ÃCªº¬O«á¾Ç¾Ç¤F¤Q´X¦~!¤µ¤Ñ¤~À´§Y®É¹Bºâµøµ¡«ç»ò¥Î!
ÁÂÁÂ

TOP

¦^´_ 20# ML089


    ÁÂÁ«e½ú«ü¾É
¤µ¤Ñ±µ¨ì¤@­Ó­«­n¤S«æªºµ{¦¡­n¶}µo
±zªº«ü¾É§Ú¦A¼·ªÅ¬ã¨s

«j±j¸ò³o¥DÃDªg¤WÃä!¯à¸Ñ´b´N¦n!
¥H«á­Y§ä¤£¨ì¬ÛÃö¥DÃD¦A¥t¶}¥DÃD½Ð±Ð
ÁÂÁÂ

TOP

¦^´_ 19# ML089


   ÁÂÁ«e½ú«ü¾É
¤@¸£ªùªº·Q¾Ç°}¦C,·Q¦b°}¦C¸Ì±Æ§Ç¦A°µ²Î­p
§Ñ¤Fµ²ªG¶K¨ìªí¸Ì¦A±Æ§Ç

±z¤Ó«È®ð¤F,«e½ú­Ì³£«Ü¼F®`¤S«Ü¼ö¤ß
ÁÂÁÂ

TOP

¦^´_ 18# Andy2483

§A°ÝÃD­Y»P¦¹ª©°ÝÃDµLÃö¡A³Ì¦n¥t¥~¶}ª©¸ß°Ý¤ñ¸û¦n¡C
{...} ªí¥Ü»Ý­n¥Î CTRL+SHIFT+ENTER ¤TÁä¿é¤J¤½¦¡

TOP

¥»©«³Ì«á¥Ñ ML089 ©ó 2021-9-17 09:33 ½s¿è

¦^´_ 18# Andy2483

µ{¦¡¥i¥H¤À¬q´¡¤J "®É¶¡¾¹" ¬Ý¬Ý­þ¤@¬q¦³°ÝÃD
®É¶¡¾¹¦p¤Uªí¤ñ¸û **4**¤Î**5**¤ñ¸û¯Ó®É¡A¦A²`¤J±´°Q

¤À¬q        ­ì©l        Àu¤Æ«á       
**1**        0        0.004       
**2**        0.168        0.168       
**3**        0.023        0.023       
**4**        1.859        1.867        ¥¼­×§ï
**5**        2.375        0.023        ­×¥¿«á
**6**        0.246        0.234       

±´°Q**5**µ{¦¡¡A Arr¦³15000¦C¡AD¦r¨å¦³100¦C¡A¥ÎÂù°j°é´N¦³15000*100 ­pºâ¨BÆJ¡A
Arr¬O¸ê®ÆµLªkÁY´î°j°é¡A¦]¦¹¦p¦ó²¤Æ D¦r¨å³o°j°é100¨BÆJ±N¬OÃöÁä
¥i¥H¦Ò¼{±N D¦r¨å ªº­È¥[¤J §Ç¸¹ ´N¥i¥H ´À¥N³o100­Ó°j°é
­ì¥ý 2.375¬í¡A¸g¹LÀu¤Æ«áÅܦ¨ 0.023¡A­è¦n¤Ö100­¿

­×§ï°Ñ¦Ò¦p¤U

Debug.Print "**4**"
Debug.Print Format(Timer - tm, "0.000"): tm = Timer

'
'Set D = Nothing
'Set D = CreateObject("SCRIPTING.DICTIONARY")
'For i = 1 To UBound(Arr)
'   TT = Arr(i, ¥æ³f¤é´ÁÄæC)
'   D(TT) = ""
'Next
'¥æ³f¤é = Application.Transpose(D.KEYS) '½Ð±Ð«e½ú ¤é´Á°}¦C­n«ç»ò±Æ§Ç??
'ReDim KLrr(1 To D.Count, 1 To 2)
'For x = 2 To UBound(Arr)
'   Cdr = Arr(x, ¥æ³f¤é´ÁÄæC)
'   For i = 2 To D.Count
'      Jdr = ¥æ³f¤é(i, 1)
'      If Cdr = Jdr Then
'         KLrr(i, 1) = KLrr(i, 1) + 1
'         KLrr(i, 2) = KLrr(i, 2) + Arr(x, SAP_POÄæM)
'         Exit For
'      End If
'   Next
'Next


Set D = Nothing
Set D = CreateObject("SCRIPTING.DICTIONARY")
For i = 2 To UBound(Arr)
   Cdr = Arr(i, ¥æ³f¤é´ÁÄæC)
   If Not D.Exists(Cdr) Then
        D(Cdr) = D.Count + 1
   End If
Next
¥æ³f¤é = Application.Transpose(D.KEYS) '½Ð±Ð«e½ú ¤é´Á°}¦C­n«ç»ò±Æ§Ç??
ReDim KLrr(1 To D.Count, 1 To 2)
For x = 2 To UBound(Arr)
   Cdr = Arr(x, ¥æ³f¤é´ÁÄæC)
   i = D(Cdr)
   KLrr(i, 1) = KLrr(i, 1) + 1
   KLrr(i, 2) = KLrr(i, 2) + Arr(x, SAP_POÄæM)
Next


Debug.Print "**5**"
Debug.Print Format(Timer - tm, "0.000"): tm = Timer
{...} ªí¥Ü»Ý­n¥Î CTRL+SHIFT+ENTER ¤TÁä¿é¤J¤½¦¡

TOP

¦^´_ 18# Andy2483

°ÝÃD¡G
1.½Ð±Ð¤W¶Ç½d¨Ò¤¤ªº¤£­«½Æ¤é´Á°}¦C¦p¦ó±Æ§Ç
2.½Ð±z«ü¾É°}¦CªºÆ[©À»P»yªk.µ²ºc..µ¥¬O§_¦³¿ù©Î°õ¦æ®Ä²v¦p¦ó´£¤É
3.°õ¦æµ²ªG±N¥Î©ó§e²{²Î­p¹Ïªí


¦^µª
1.±Æ§Ç¤@¯ë¥i¥H¸ê®Æ¼g¤Jªí®æ«á¡A¦A¥ÎEXCEL±Æ§Ç¥\¯à³B²z¡A°Ñ¦Ò¦p¤U

' ±Æ§Ç J:L ½d³òªº¸ê®Æ
' Key1:=Range("J1")    ¨Ì¾Ú A Äæ±Æ§Ç
' Order1:=xlAscending  ¤É¾­±Æ§Ç
' Header:=xlYes        ¦³¼ÐÃD¦C
Range("J:L").sort Key1:=Range("J1"), Order1:=xlAscending, Header:=xlYes


2.§Ú¤]¬O³Ìªñ¤~¦bºNVBA¤£¾A«ÜÀ´¡A§Ú±`¥Î¨ç¼ÆÆ[©À¦b¼gVBA¦³ÂI©Ç©Çªº¡A§Ú¦Û¤v¤]¦bºN¯Á¤¤¤]¸ò¤j®a¤@¼Ë¬Û¤¬Æ[¼¯¾Ç²ß¡C
{...} ªí¥Ü»Ý­n¥Î CTRL+SHIFT+ENTER ¤TÁä¿é¤J¤½¦¡

TOP

¦^´_ 16# ML089


    «e½ú¦n
1.½Ð±Ð¤W¶Ç½d¨Ò¤¤ªº¤£­«½Æ¤é´Á°}¦C¦p¦ó±Æ§Ç
2.½Ð±z«ü¾É°}¦CªºÆ[©À»P»yªk.µ²ºc..µ¥¬O§_¦³¿ù©Î°õ¦æ®Ä²v¦p¦ó´£¤É
3.°õ¦æµ²ªG±N¥Î©ó§e²{²Î­p¹Ïªí
°}¦CÆ[©ÀÃjÃjÀ´À´,½Ð«e½ú­Ì«ü¾É

¤é´Á°}¦C±Æ§Ç_20210916-1.zip (745.65 KB)

TOP

¦^´_ 16# ML089


    ÁÂÁ«e½ú«ü¾É
key¬O¾î¦V±Æ¦Cªº,±N¤§Âà¸m«á¤~¦¨¬°Áa¦V±Æ¦C
ÁÂÁ«ü¾É

TOP

¦^´_ 15# Andy2483

    [C1].Resize(D.Count, 1) = D.KEYS
§ï¬°
    [C1].Resize(D.Count, 1) = Application.Transpose(D.KEYS)
{...} ªí¥Ü»Ý­n¥Î CTRL+SHIFT+ENTER ¤TÁä¿é¤J¤½¦¡

TOP

        ÀR«ä¦Û¦b : ¥ÌÄ@°µ¡BÅw³ß¨ü¡C
ªð¦^¦Cªí ¤W¤@¥DÃD