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

[µo°Ý] ¤ñ¹ï¸ê®Æ¡A¤£¬Û¦Pªº¸ê®ÆÅã¥Ü©ó¥k°¼

[µo°Ý] ¤ñ¹ï¸ê®Æ¡A¤£¬Û¦Pªº¸ê®ÆÅã¥Ü©ó¥k°¼

·Q½Ð°Ý¯¸¤Wªº«e½ú­Ì
§Ú¦³¨â­Ó¸ê®Æ(¤â°Ê©ñ¸m¦P­¶­±¤F)»Ý­n¤ñ¹ï3­Ó¸ê®Æ
¤À§O¬O[®y¼Ð¡AÂI¼Æ¡A¦a§}]
¦pªG¨ä¤¤¦³¤@ºØ¸ê®Æ¤£¦P«h·|Åã¥Ü©ó¥k°¼
¦Ó¨â­Ó¸ê®Æ¤£­«½Æ¸ê®Æ«h¬O¦U©ñ¦b¦UÃ䪺¥k°¼
¦³ÂIÃþ¦üExcelªº²¾°£­«½Æ¥\¯à¡A¦ý¬O¤£²¾°£¡A¦Ó¬O©ñ¸m¦b¥k°¼

½Ð°Ý¦³¿ìªk¥Î¤½¦¡°µ¨ì¶Ü ?

¦^´_ 16# ­ã´£³¡ªL


    ÁÂÁ«e½ú
«á¾Ç¥Î¤ñ¸û²Âªº¤èªk½m²ß°}¦C»P¦r¨å!
½Ð«e½ú¼·ªÅ«ü¥¿¨Ã«ü¾É!ÁÂÁÂ



Option Explicit
Sub °}¦C»P¦r¨å½m²ß()
Dim Arr, N&, i&, Y, A&, S, TT$
Dim B#, j&, K%, P$, Q, Ra
Set Y = CreateObject("Scripting.Dictionary")
S = Timer
[O4:AA20000].Clear
Set Y = CreateObject("Scripting.Dictionary")
Arr = Range([M4], Cells(Rows.Count, 1).End(xlUp).Offset(1))
ReDim Brr(1 To UBound(Arr), 1 To 13)
For i = 2 To UBound(Arr) - 1
   TT = Arr(i, 1) & Arr(i, 4) & Arr(i, 8)
   Y(A & "|" & TT & "|" & i) = i
   Y(A & "|" & TT) = Y(A & "|" & TT) + 1
   If Arr(i + 1, 1) = "®y¼Ð" Then
      A = i + 1
      i = A
   End If
Next
For i = 1 To UBound(Arr) - 1
   If i = A Then
      N = A - 1
   End If
   TT = Arr(i, 1) & Arr(i, 4) & Arr(i, 8)
   If Y("0|" & TT) = Y(A & "|" & TT) And i <> 1 And i <> A Then
      ElseIf Y("0|" & TT) > 1 Then
         Y("0|" & TT) = Y("0|" & TT) - 1 '­Y¬Û¦P!¯d³Ì«á¤@µ§
      ElseIf Y(A & "|" & TT) > 1 Then
         Y(A & "|" & TT) = Y(A & "|" & TT) - 1 '­Y¬Û¦P!¯d³Ì«á¤@µ§
      Else
         N = N + 1
         For j = 1 To 13
            Brr(N, j) = Arr(i, j)
         Next
   End If
Next
With [O4:AA4].Resize(UBound(Brr))
     .NumberFormatLocal = "@"
     .Value = Brr
     .Borders.LineStyle = 1
End With
MsgBox Timer - S & " ’"
End Sub

TOP

¦^´_ 16# ­ã´£³¡ªL
        ÁÂÁ«e½ú!³o¤ÓÃø¤F!
¥H¤U¤ß±oµù¸Ñ!½Ð«e½ú¦A«ü¾É!
°õ¦æ«e:


°õ¦æµ²ªG:


Option Explicit
Sub TEST()
Dim Arr, Brr, xD, i&, j%, U&, V&, N&, T1$, T2$, T3$, S
S = Timer
'¡ô«Å§iÅܼÆ
[O4:AA20000].Clear
'¡ô±NÀx¦s®æ²M°£
Set xD = CreateObject("Scripting.Dictionary")
'¡ô¥OxD¬O¦r¨å
Arr = Range([M4], Cells(Rows.Count, 1).End(xlUp))
'¡ô¥OArr¬O¦r¨å!­Ë¤J:[M4]¨ìAÄæ³Ì«á¤@¦³¤º®eÀx¦s®æ¤§¶¡,
'ÂX®i¬°³Ì¤p¤è¥¿°Ï°ìÀx¦s®æªº­È

ReDim Brr(1 To UBound(Arr), 1 To 13)
'¡ô«Å§iBrrªÅ°}¦C½d³òÁa¦V±q1¨ìArr°}¦CÁa¦V³Ì¤j¦C¼Æ,
'¾î¦V±q1¨ì13Äæ(¨â­Ó°}¦C¤j¤p¬Û¦P)

For i = 2 To UBound(Arr)
'¡ô³]¶¶°j°é!±q2 ¨ìArr°}¦CÁa¦V³Ì¤j¦C¼Æ
    T1 = Arr(i, 1) '®y¼ÐÄæ
    '¡ô¥OT1¬OArr°}¦C°j°é¦C/²Ä¤@Äæ­È
   
    T2 = Arr(i, 4) 'ÂI¼ÆÄæ
    '¡ô¥OT2¬OArr°}¦C°j°é¦C/²Ä¥|Äæ­È
   
    T3 = Arr(i, 8) 'ÂI¼ÆÄæ
    '¡ô¥OT3¬OArr°}¦C°j°é¦C/²Ä¤KÄæ­È
   
    If T1 = "®y¼Ð" Then
    '¡ô¦pªGÀx¦s®æ[M4] ¸Ìªº­È¬O "®y¼Ð" ¦r¦ê??
       V = i - 1  '@@
       '¡ô±ø¥ó¦¨¥ß´N¥O V°O¾Ð¬O·í¤U°j°é¼Æ -1 ,³o¬O­n¿ë»{A°Ï³Ì«á¦C¼Æ
       GoTo 101
       '¡ô±ø¥ó¦¨¥ß´N¸õ¨ì 101¦ì¸mÄ~Äò°õ¦æ
       ',B°Ï¼ÐÃD¦C!¦¹¦C¤£³B²z

    End If
    If T1 = "" Or T2 = "" Or T3 = "" Then
    '¡ô¦pªG°j°é®y¼Ð °j°éÂI¼Æ °j°éÂI¼Æ¥ô¦ó¤@­Ó¬OªÅ¥Õ
       GoTo 101
       '¡ô±ø¥ó¦¨¥ß´N¸õ¨ì 101¦ì¸mÄ~Äò°õ¦æ,³o¬O¤£³B¸ÌªÅ¥Õ®æ
    End If
    U = xD(T1 & T2 & T3)
    '¡ô¥OU¬O (°j°é®y¼Ð,°j°éÂI¼Æ,°j°éÂI¼Æ)²Õ¦X¦r¦ê_¥H¤UºÙ(²Õ¦X¦r¦ê)¬°keyªºitem­È
    'ªì©l­È¬O 0

    If U = 0 Then
    '¡ô¦pªGU ¬Oªì©l­È¬O 0,¦]¬° U«Å§iªø¾ã¼Æ
       xD(T1 & T2 & T3) = i
       '¡ô±ø¥ó¦¨¥ß!²Õ¦X¦r¦ê¬°key­Ë¤JxD¦r¨å!item­È¬O°j°é¼Æ
       '³o¬O¢Ï°Ï¦³¦hµ§¬Û¦P¡A¥u¨ú¤@µ§(B°Ï¦P²z)! ¦C¼Æ°O¾Ð¦b¦r¨åitem¸Ì

       GoTo 101
       '¡ô±ø¥ó¦¨¥ß´N¸õ¨ì 101¦ì¸mÄ~Äò°õ¦æ
    End If
    If U > 0 And U <= V Then
    '¡ô¦pªGU¤£¬Oªì©l­È!¤w¸g¦³°j°é¼Æ§@¬° item ¤F
    '¦Ó¥BUªº¦C¼Æ¤p©óµ¥©ó(A°Ï³Ì«á¦C¼Æ)!¤]´N¬O¦bA°Ï¦³¥BB°Ï¤]¦³!

       xD(T1 & T2 & T3) = -1
       '¡ô±ø¥ó¦¨¥ß!´N¥O¦bxD¦r¨å¸Ì¥H²Õ¦X¦r¦ê¬°keyªºitem¬° -1
       '³o¸Ìªº -1¬O¤£Åý¼g¤JBrr°}¦C¸Ì

    End If
101: Next i

'1.A°Ï/B°Ï¦P®É¦s¦b,­ç°£
'2.A°Ï¦³¦hµ§¬Û¦P,¥u¨ú¤@µ§(B°Ï¦P²z)

'¡ô°õ¦æ¥\¯àÁöµM¬O¦p¦¹±Ô­z!¦ý«á¾Ç¦bÅÞ¿è¸Ìªº¤ß±o¬O:
'1.1.¥þ³¡°j°é§PÂ_¥u¦³¤@µ§ªº´N¯dµÛ!¦r¨å°O¾Ð©Ò¦b¦C¼Æ!¨SÄa©À!ºÞ¥LA°Ï ©Î B°Ï
'1.2.¥þ³¡°j°é§PÂ_¦³¦hµ§ªº!§ä¨ì¬Û¦Pªº²Ä¤Gµ§¬Ý¬O¤£¬O¦b¦P°Ï,¦b¤£¦P°Ï³oµ§¨â°Ï³£¤£­n¤F


For i = 1 To UBound(Arr)
'¡ô³]¥~¶¶°j°é!±q1 ¨ìArr°}¦CÁa¦V³Ì¤j¦C¼Æ
    T1 = Arr(i, 1) '®y¼ÐÄæ
    '¡ô¥OT1¬OArr°}¦C°j°é¦C/²Ä¤@Äæ­È
   
    T2 = Arr(i, 4) 'ÂI¼ÆÄæ
    '¡ô¥OT2¬OArr°}¦C°j°é¦C/²Ä¥|Äæ­È
   
    T3 = Arr(i, 8) 'ÂI¼ÆÄæ
    '¡ô¥OT3¬OArr°}¦C°j°é¦C/²Ä¤KÄæ­È
    U = xD(T1 & T2 & T3)
    '¡ô¥OU¬O (°j°é®y¼Ð,°j°éÂI¼Æ,°j°éÂI¼Æ)²Õ¦X¦r¦ê_¥H¤UºÙ(²Õ¦X¦r¦ê)¬°keyªºitem­È
    'ªì©l­È¬O 0
    If T1 = "®y¼Ð" And N > 0 Then
    '¡ô³o T1 = "®y¼Ð" ¬O­n¿ë»{B°Ï¼ÐÃD¦C¼Æ
    '¡ô¦pªG°j°é¶]¨ì¤F B°Ï¼ÐÃD¦C¼Æ ¦Ó¥BN > 0 ,N«Å§i¬°ªø¾ã¼Æ!ªì©l­È¬O 0
    ',©Ò¥H¤@¶}©l±ø¥ó¬O¤£·|¦¨¥ßªº!³oºØÅÞ¿è¼gªk»Ý­n¸õ²æ²´¨£¬°¾ÌªºÆ[©À!
    'ÅÞ¿è®Ø¬[·§©À»Ý­n½m²ß!µL¤¤¥Í¦³ªºN ¥ýª¾¹D­n¬d«Å§i´N¥i¥H¤F!
    '¡ô°j°éªº¤@¶}©l±ø¥ó¬O¤£·|¦¨¥ßªº!
    '¦]¬°·íi=1,T1 = "®y¼Ð",N=0 , ·íi=2,N=1,T1 ¤w¸g¤£¬O¦r¦ê "®y¼Ð"

   
       N = V
       '¡ôª½¨ìB°Ï¼ÐÃD¦C¶}©l±ø¥ó¦¨¥ß!´N¥ON=V!  V:¦b¤W¤è @@¼Ð¥Ü³B
       '³o¬O­nÅý ¸ê®Æ­n¼g¤Jµ²ªG°}¦CBrrªº¦C¼Æ ¤Á´«¨ìB°Ï¶}©l²Ö¥[¦C¼Æ¥Îªº
    End If
    If T1 = "®y¼Ð" Or U = i Then
    '¡ô¦pªG°j°é®y¼ÐÄæ¬O "®y¼Ð"¦r¦ê(¼ÐÃD¦C¤]­n¼g¶i°}¦CBrr¸Ì)
    '©Î ¦pªG²Õ¦X¦r¦ê¬°keyªºitem¬O°j°é¼Æ??

       N = N + 1
       '¡ô±ø¥ó¦¨¥ß! N´N²Ö¥[ 1,³o¬O¸ê®Æ­n¼g¤Jµ²ªG°}¦CBrrªº¦C¼Æ
       For j = 1 To 13
       '¡ô³]¤º¶¶°j°é!±q1 ¨ì 13(Äæ¼Æ)
          Brr(N, j) = Arr(i, j)
          '¡ôArr°}¦Cªº­È­Ë¤JBrr°}¦C N¹ïÀ³ªº¦C¦ì/jÄæ¦ì¸Ì
       Next
    End If
Next i
With [O4:AA4].Resize(UBound(Brr))
'¡ôÃö©ó[O4:AA4]¦V¤U¦J¦CBrr°}¦CÁa¦V³Ì¤j¦C¼Æªº½d³òÀx¦s®æ,¥H¤UºÙ(¦J¦C®æ)
     .NumberFormatLocal = "@"
     '¡ô¦J¦C®æªº®æ¦¡³]¬° ¤å¦r
     .Value = Brr
     '¡ô­È¬OBrr°}¦C¸Ì¹ïÀ³ªº­È
     .Borders.LineStyle = 1
     '¡ôÀx¦s®æ®æ½u³]¬° ²Ó¹ê½u
End With
MsgBox Timer - S & " ’"
End Sub

TOP

¦^´_ 16# ­ã´£³¡ªL
¦^´_ 16# faye59
¨S·Q¨ìÁÙÅý¤j¤j¥X¤â¨ó§U
¶W¯Å·PÁ ­ã´£³¡ªL ª©¥D¤j¤jªºÀ°¦£

µ{¦¡¹B§@¨S°ÝÃD¡A¤]¯à®M¥Î¦b¨ä¥L¤À­¶¸ê®Æ¤W
°l¥[ªº¢±¡Ö¢Ï°Ï¦³¦hµ§¬Û¦P¡A¥u¨ú¤@µ§¡]¢Ð°Ï¦P²z¡^¤]«Ü¦n¥Î
µ{¦¡¤º®e¤º³¡­×§ï¼ÐÃD·j´M¡A´N¯à¹B¥Î¦b¨ä¥L¸ê®Æ¤W¤F
µ{¦¡½X©w¸q©M½s¦¨ÁÙ­n¦b¤F¸Ñ¤@¤U

¤]·PÁÂfaye59ªº¦^ÂÐ

¦A¦¸·PÁ¨ó§U¹Lªº¤j¤j­ÌªºÀ°¦£

TOP

¦^´_ 15# jackson7015


    ©êºp¡A
¨S¬Ý¨ì«á­±ÁÙ¦³²Ä¤G­¶¡A
¤j­P¤W©ú¥Õ§A­nªºµ²ªG¤F¡A
¦ý­ã¤j¤w¥X°¨¡A
¤p§Ì´N¤£ÂØ­z¤F¡C
¤@¤À§V¤O¡A¤@¤À¦¬Ã¬¡C
µo°ÝÃD«e¥i¥H¥ý·j¯Á¤º¤å¬O§_¦³¬ÛÃö½d¨Ò¡C

TOP

¦^´_ 9# jackson7015


    ¦p10¼Ó©Ò¨¥
¤£À´¤À³Î¥Î·N¡A
µ{§Ç¤]¥i¥H¼g¦¨Åý§A¤è«KÀ˵ø¡A
¦ý§A­n§â§Aªº¹Lµ{¤Îµ²ªG¸Ô²Ó´£¥X¡A
¹Lµ{:°õ¦æªº­­¨î±ø¥ó¡C
µ²ªG:°õ¦æ«á©Ò·Q¬Ýªº¸ê°T¡C
­n¼g¨ì¥¨¶°´X¥G³£¬O¬°¤F®Ä²v¡A
Ãø¥H­pºâ¡B­«½Æ°Ê§@¤Ó¦h¡B¨C¤é¦P¼Ë¾Þ§@Ácº¾...µ¥ª¬ªp¡A
§Ú­Ì´N·|¥H¥¨¶°Â²©ö¥B§Ö³t­pºâ¡C

«Øij¤â°Ê¥ý§â§Aªº½d¨Òµ²ªG¤W¶Ç¡A
¥i¯àµ{¦¡½X§A¤£¬O«Ü¼ô¡A
¤£ª¾¹Dµ{§Ç¯à°õ¦æªº®ÄªG¨ì­þ¡A
©Ò¥H·¾³q¤W¦³©Ò®t²§¡A
§AÁ¿ªº°ÝÃD§Ú­Ì³£·|¦b¸£¤¤¥ý¸g¹L­pºâ¬Ý¬O§_¥i¦æ©Î¬O§_Ácº¾¡A
ı±o¥i¥H¤~·|¦^ÂЧAªº°ÝÃD¡C
¤@¤À§V¤O¡A¤@¤À¦¬Ã¬¡C
µo°ÝÃD«e¥i¥H¥ý·j¯Á¤º¤å¬O§_¦³¬ÛÃö½d¨Ò¡C

TOP

¢°¡Ö¢Ï°Ï¡þ¢Ð°Ï¦P®É¦s¦b¡A­ç°£
¢±¡Ö¢Ï°Ï¦³¦hµ§¬Û¦P¡A¥u¨ú¤@µ§¡]¢Ð°Ï¦P²z¡^
¢²¡Ö¥k°¼µ²ªG¨Cµ§¤§¶¡¤£¯dªÅ¥Õ¦æ¡A¨â°Ï¦U¦Û¤W¤U°Ï¦s©ñ

¼g±o¦³ÂI½ÆÂø¡A¦Û¦æ³v¦æ°Ñ°u¡G
Xl0000283.rar (214.58 KB)

Sub TEST()
Dim Arr, Brr, xD, i&, j%, U&, V&, N&, T1$, T2$, T3$
[O4:AA20000].Clear
Set xD = CreateObject("Scripting.Dictionary")
Arr = Range([M4], Cells(Rows.Count, 1).End(xlUp))
ReDim Brr(1 To UBound(Arr), 1 To 13)
For i = 2 To UBound(Arr)
    T1 = Arr(i, 1): T2 = Arr(i, 4): T3 = Arr(i, 8)
    If T1 = "®y¼Ð" Then V = i - 1: GoTo 101
    If T1 = "" Or T2 = "" Or T3 = "" Then GoTo 101
    U = xD(T1 & T2 & T3)
    If U = 0 Then xD(T1 & T2 & T3) = i: GoTo 101
    If U > 0 And U <= V Then xD(T1 & T2 & T3) = -1
101: Next i

For i = 1 To UBound(Arr)
    T1 = Arr(i, 1): T2 = Arr(i, 4): T3 = Arr(i, 8)
    U = xD(T1 & T2 & T3)
    If T1 = "®y¼Ð" And N > 0 Then N = V
    If T1 = "®y¼Ð" Or U = i Then
       N = N + 1
       For j = 1 To 13: Brr(N, j) = Arr(i, j): Next
    End If
Next i

With [O4:AA4].Resize(UBound(Brr))
     .NumberFormatLocal = "@"
     .Value = Brr
     .Borders.LineStyle = 1
End With
End Sub

¡@

TOP

¦^´_ 14# zheng211016
·PÁÂzheng211016ªºÀ°¦£

´ú¸Õ¦n´X¦¸³£©Ç©Çªº
µo²{­ì¨Ó¬OEXCELªº§R°£­«½Æ¤è¦¡·|§â­«½Æªº¯d¤@­Ó¤U¨Ó
¦ý¬O¸ê®Æ»Ý¨D¤£»Ý­n¯d­«½Æªº¶µ¥Ø

©Ò¥H¥u­n¦³­«½Æªº¡A³£¤£»Ý­n½Æ»s¨ì¥k°¼
¦Ó¦]¬°¸ê®Æ¦C¦]¬°ÁÙ¦³¨ä¥L¤£¦Pªº¸ê®Æ
©Ò¥H¦C¦ì·|¦³¤£¤@¼Ë(Äæ¦ì³£¬Û¦P)

¦pªG¨Ï¥Î¥¨¶°¥i¯àÁÙ­n°µ¦C¦ì¦h¹è§P©w
¥i¯à·|¤ñ¸û³Â·Ð

¦A½Ð¦U¦ì¤j¤j¬Ý¬Ý
·P¿E¤£ºÉ~

TOP

¦^´_ 13# jackson7015

§Úµy·LÀ´¤@ÂI§A­nªºªF¦è
¥u¬OÁÙ¤£¬O«Ü²M·¡
¦ý¬O¤j­P¤W¬O¤£¬O´N¬O
¤W¥b³¡¸ê®Æ : 5~2676
¤U¥b³¡¸ê®Æ : 2677~5562

¤W¥b³¡¸ê®Æ ¸ò ¤U¥b³¡¸ê®Æ ¹ï·Ó

¤W¥b³¡¥k°¼¸ê®Æ :  »P ¥ª°¼¤U¥b³¡ ¤£­«½Æªº¸ê®Æ
¤U¥b³¡¥k°¼¸ê®Æ :  »P ¥ª°¼¤W¥b³¡ ¤£­«½Æªº¸ê®Æ

µM«á¤U¤èÀɮקڬO§Q¥Îvba¼ÒÀÀ§A»¡ªº¨Ï¥Î²¾°£­«½Æ¥\¯à §A¥ý¬Ý¬Ý
    ©ú²Ó3.rar (521.98 KB)

TOP

¦^´_ 12# zheng211016
§e²{ªºªºµ²ªG¤j·§´N¬O¤U­±ªºÀɮרº¼Ë
¦ý¬O§Ú¬O±N¸ê®Æ¥ý½Æ»s¨ì¤u§@­¶­±1
µM«á§R°£¤£»Ý­n¤ñ¹ïªº³¡¤À
¦A¥Î§R°£­«½Æªº¤è¦¡±o¥Xµ²ªG
¦A§â¸ê®Æ¦^¶Ç

¤£¾å±oªí¹Fªº¤è¦¡¡A¯à¤£¯à¤F¸Ñ

    ©ú²Ó3.rar (999.75 KB)

TOP

        ÀR«ä¦Û¦b : ¡i®É¶¡¦¨´N¤@¤Á¡j®É¶¡¥i¥H³y´N¤H®æ¡A¥i¥H¦¨´N¨Æ·~¡A¤]¥i¥HÀx¿n¥\¼w¡C
ªð¦^¦Cªí ¤W¤@¥DÃD