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

[µo°Ý] ¦p¦ó¤ñ¹ï¥XA/BÄæ­«½Æ¤Î¤í¯Ê¤§¼Æ­È

¦^´_ 10# dechiuan999

±z¦n µ{¦¡¥i¥H¥Î¤F!
¦ý¦pªG¸ê®Æ§ïÅܦpªþÀÉ¥B¤W¤dµ§·|¥X²{¿ù»~¡A³Ò¾r±zÀ°¦£¬Ý¬Ý¡C

¼Æ­È¤ñ¹ï2.rar (65.37 KB)

TOP

¦^´_ 11# loyyee
¨Ã«D¸ê®Æµ§¼Æ°ÝÃD
¬O¦pªG¨S¦³©M±ø¥óªº¸ê®Æ´N·|³y¦¨Resize¥X¿ù
  1. Sub Ex()
  2. Dim Ay(), Ay1()
  3. Set d = CreateObject("Scripting.dictionary")
  4. Set d1 = CreateObject("Scripting.dictionary")
  5. [E6].CurrentRegion.Offset(1, 0) = ""
  6. [I1].CurrentRegion.Offset(1, 0) = ""

  7. ar1 = [A1].CurrentRegion.Columns(1).Value
  8. ar2 = [A1].CurrentRegion.Columns(2).Value
  9. ar = Array(ar1, ar2)
  10. For i = 0 To 1
  11. For Each a In ar(i)
  12.    Select Case i
  13.    Case 0
  14.    If a <> "" Then d(a) = d(a) + 1
  15.    Case 1
  16.    If a <> "" Then d1(a) = d1(a) + 1
  17.    End Select
  18. Next
  19. Next
  20. dic = Array(d, d1)
  21. For i = 0 To 1
  22. For Each ky In dic(i).keys
  23. p = IIf(i = 0, 1, 0)
  24.    If dic(p).exists(ky) = False Then
  25.    ReDim Preserve Ay(s)
  26.    Ay(s) = ky
  27.    s = s + 1
  28.    End If
  29.    If dic(i)(ky) > 1 Then
  30.    ReDim Preserve Ay1(k)
  31.    Ay1(k) = ky
  32.    k = k + 1
  33.    End If
  34. Next
  35. If s > 0 Then Cells(2, 9 + i).Resize(s, 1) = Application.Transpose(Ay): s = 0: Erase Ay
  36. If k > 0 Then Cells(7, 5 + i).Resize(k, 1) = Application.Transpose(Ay1): k = 0: Erase Ay1
  37. Next
  38. End Sub
½Æ»s¥N½X
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

¦^´_ 12# Hsieh

¥i¥H¥Î¤F¡AHsieh·PÁ±z«üÂI!

TOP

·PÁ¦U¤j¤jªº¤À¨É,,ÁöµM¤£¯à¤U¸üªþ¥ó¤]¾Ç²ß¤F

TOP

¦^´_ 12# Hsieh

If s > 0 Then Cells(2, 9 + i).Resize(s, 1) = Application.Transpose(Ay): s = 0: Erase Ay ­n§ï¦¨
If s > 0 Then Cells(2, 10 - i).Resize(s, 1) = Application.Transpose(Ay): s = 0: Erase Ay
   
¤í¯Ê¼Æ­ÈÄæ¦ì¤~·|¹ïÀ³¨ì¡C

TOP

ÁÂÁ½׾Â,ÁÂÁ¦U¦ì«e½ú
«á¾ÇÂǦ¹©«½m²ß°}¦C»P¦r¨å,¾Ç²ß¤è®×¦p¤U,½Ð¦U¦ì«e½ú«ü±Ð

°õ¦æ«e:


°õ¦æµ²ªG:



Option Explicit
Sub TEST()
Dim Brr, Va&, Vb&, Z, Q, i&, Ra&, Rb&, M&, Ta$, Tb$
[E7:F65536,I2:J65536].ClearContents
Set Z = CreateObject("Scripting.Dictionary")
Brr = Intersect([A1].CurrentRegion, [A:B])
For i = 1 To UBound(Brr)
   Ta = Brr(i, 1): Tb = Brr(i, 2): Brr(i, 1) = "": Brr(i, 2) = ""
   If Ta = "" Then GoTo i01 Else Va = Z(Ta)
   If Va = 1 Then
      Ra = Ra + 1
      Brr(Ra, 1) = Ta
      M = IIf(M < Ra, Ra, M)
      Else:
         Z(Ta) = 1
   End If
i01: If Tb = "" Then GoTo i02 Else Vb = Z("|" & Tb)
   If Vb = 1 Then
      Rb = Rb + 1
      Brr(Rb, 2) = Tb
      M = IIf(M < Rb, Rb, M)
      Else
         Z("|" & Tb) = 1
   End If
i02: Next
If M > 0 Then [E7].Resize(M, 2) = Brr
ReDim Brr(1 To UBound(Brr), 1 To 2)
Ra = 0: Rb = 0: M = 0
For Each Q In Z.KEYS
   If InStr(Q, "|") = 0 Then
      If Z.Exists("|" & Q) = Empty Then
         Rb = Rb + 1
         Brr(Rb, 2) = Q
      End If
      ElseIf Z.Exists(Mid(Q, 2)) = Empty Then
         Ra = Ra + 1
         Brr(Ra, 1) = Mid(Q, 2)
   End If
   If M < Ra Then M = Ra
   If M < Rb Then M = Rb
Next
If M > 0 Then [I2].Resize(M, 2) = Brr
Set Z = Nothing: Erase Brr
End Sub
¥Î¦æ°Ê¸Ë¸mÂsÄý½×¾Â¾Ç²ß«Ü¤è«K,ÁÂÁ½׾¸gÀç¹Î¶¤
½Ð¤j®a¤@°_¤W½×¾Â¨Ó¥æ¬y

TOP

        ÀR«ä¦Û¦b : ¤p¨Æ¤£°µ¡B¤j¨ÆÃø¦¨¡C
ªð¦^¦Cªí ¤W¤@¥DÃD