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

¦P¤@µo²¼¸¹½X¦C¥X©Ò¦³­q³æ½s¸¹(¦C¦b¦P¤@Àx¦s®æ)

¦P¤@µo²¼¸¹½X¦C¥X©Ò¦³­q³æ½s¸¹(¦C¦b¦P¤@Àx¦s®æ)

¦C¥X¦P¤@µo²¼¸¹½Xªº©Ò¦³­q³æ½s¸¹(Åã¥Ü¦b¦P¤@Àx¦s®æ)
µª®×§e²{µ²ªG¦pDÄæ¤ÎEÄæ
joyce

E2¤½¦¡
Exel 2003
=INDEX($B:$B,SMALL(($D2<>$A$2:$A$7)*999+ROW($2:$7),COLUMN(A1)))&IF(F9="","","¡B"&F9)
¥k©Ô¦ÜªÅ®æ¥X²{¡A¦b¾ã­Ó¤U©Ô

Excel 365
=TEXTJOIN("¡B",,IF(D2=A$2:A$7,B$2:B$7,""))
¤U©Ô
{...} ªí¥Ü»Ý­n¥Î CTRL+SHIFT+ENTER ¤TÁä¿é¤J¤½¦¡

TOP

google"EXCEL°g"  blog  ©Îgoogleºô§}:https://hcm19522.blogspot.com/

TOP

¦^´_ 1# leiru
½Ð´ú¸Õ¬Ý¬Ý¡AÁÂÁÂ
Sub test()
Dim Arr, xD, i&, T$
Set xD = CreateObject("Scripting.Dictionary")
Arr = Range([a1], [b65536].End(3))
For i = 2 To UBound(Arr)
    T = Arr(i, 1): If T = "" Then GoTo 99
    If xD.Exists(T) Then
        xD(T) = xD(T) & "¡B" & Arr(i, 2)
    Else
        xD(T) = Arr(i, 2)
    End If
99: Next i
Range("d2").Resize(xD.Count, 1) = Application.Transpose(xD.keys)
Range("e2").Resize(xD.Count, 1) = Application.Transpose(xD.Items)
End Sub

TOP

¦^´_ 4# samwang


    ½Ð±Ð«e½ú ¦r¨å¥u¯à1­Ókey¹ïÀ³item? ¥i¥H1­Ó¹ï¦h­Ó¶Ü?

TOP

¦^´_  samwang


    ½Ð±Ð«e½ú ¦r¨å¥u¯à1­Ókey¹ïÀ³item? ¥i¥H1­Ó¹ï¦h­Ó¶Ü?
Andy2483 µoªí©ó 2021-10-14 12:00


key¥i¥H«Ü¦h­Ó¡A¦ý¬O¨C­Ókey ¬O°ß¤@¡A¥B¹ïÀ³ªºitem¥i¥H«Ü¦h­Ó¡AÁÂÁ¡C

TOP

¦^´_ 6# samwang


    ÁÂÁ«ü¾É
¦A½Ð±Ð
¦pªGµo²¼¸¹½X¹ïÀ³ªº«È¤á­q³æ¤£­n¥Î¡B²Å¸¹­Ó¶}©ñ¦P¤@Àx¦s®æ,
¦Ó¬O¤À¶}©ñ¦b¥k°¼ªºÀx¦s®æ±µ¤U¥h©ñ!­n«ç»ò§ï?

TOP

¦^´_  samwang


    ÁÂÁ«ü¾É
¦A½Ð±Ð
¦pªGµo²¼¸¹½X¹ïÀ³ªº«È¤á­q³æ¤£­n¥Î¡B²Å¸¹­Ó¶}©ñ¦P¤@Àx¦s®æ,
...
Andy2483 µoªí©ó 2021-10-14 12:35


Sub test2()
Dim Arr, Brr(), xD, T$, k, TC%, TC1%, R%, C%
Set xD = CreateObject("Scripting.Dictionary")
Arr = Range([a1], [b65536].End(3))
For i = 2 To UBound(Arr)
    T = Arr(i, 1): If T = "" Then GoTo 99
    If xD.Exists(T) Then
        xD(T) = xD(T) & "¡B" & Arr(i, 2)
    Else
        xD(T) = Arr(i, 2)
    End If
99: Next i
ReDim Brr(1 To xD.Count, 1 To UBound(Arr))
R = 1
For Each k In xD.keys
    xD(k) = Split(xD(k), "¡B")
    TC = UBound(xD(k)) + 2
    If TC > TC1 Then TC1 = TC
    Brr(R, 1) = k
    For C = 2 To UBound(xD(k)) + 2
        Brr(R, C) = xD(k)(C - 2)
    Next
    R = R + 1
Next
Range("g2").Resize(R - 1, TC1) = Brr
End Sub

TOP

¦^´_ 8# samwang


    ÁÂÁ«ü¾É!
¦pªG¦C¼Æ¦h!±zªº°õ¦æªº®É¶¡¤ñ§Ú·|ªº¤è¦¡§Ö«Ü¦h!
ÁÂÁ«e½ú«ü¾É! xD(k)(C - 2)

Sub test2_1()
Dim Arr, Brr(), xD, T$, k, MA%, R%, C%
Set xD = CreateObject("Scripting.Dictionary")
Arr = Range([a1], [b65536].End(3))
For i = 2 To UBound(Arr)
    T = Arr(i, 1): If T = "" Then GoTo 99
    xD(T) = xD(T) + 1
99: Next i
MA = WorksheetFunction.Max(xD.Items)
ReDim Brr(0 To xD.Count, 1 To MA + 1)
i = 0
For Each k In xD.keys
    Brr(i, 1) = k
    R = 2
    For C = 2 To UBound(Arr)
       If Arr(C, 1) = Brr(i, 1) Then
          Brr(i, R) = Arr(C, 2)
          R = R + 1
       End If
    Next
    i = i + 1
Next
Range("g2").Resize(xD.Count, MA + 1) = Brr
End Sub

TOP

¨âÄ榡:
Sub test_01()
Dim Arr, xD, i&, T$, T2$, R&, N&
Set xD = CreateObject("Scripting.Dictionary")
Arr = Range([a1], [b65536].End(3))
For i = 2 To UBound(Arr)
    T = Arr(i, 1): T2 = Arr(i, 2): R = xD(T)
    If T = "" Or T2 = "" Then GoTo 99
    If R > 0 Then Arr(R, 2) = Arr(R, 2) & "¡B" & T2: GoTo 99
    N = N + 1: R = N + 1: xD(T) = R
    Arr(R, 1) = Arr(i, 1):  Arr(R, 2) = T2
99: Next i
Range("d1").Resize(N + 1, 2) = Arr
End Sub

TOP

        ÀR«ä¦Û¦b : ª¾ÃÑ­n¥Î¤ßÅé·|¡A¤~¯àÅܦ¨¦Û¤vªº´¼¼z¡C
ªð¦^¦Cªí ¤W¤@¥DÃD