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

½Ð±ÐExcel¨ç¼Æ³]©w(vlook¡Bif)ªº°ÝÃD¡A¨Ã¥B±NÀÉ®×Åܧ󬰫ü©w®æ¦¡

½Ð±ÐExcel¨ç¼Æ³]©w(vlook¡Bif)ªº°ÝÃD¡A¨Ã¥B±NÀÉ®×Åܧ󬰫ü©w®æ¦¡

¥Ø«e¦³¤@¤jµ§¸ê»Ý­n¥h§PÂ_¨ä¸¹½X¡A¨Ã¥B§ï¬°¾î¦¡

­ì©lÀɽd¨Ò:
¸¹½X                            ³f¸¹
AQ27304209        62055202
AQ27304210        62009257
AQ27304210        62111432
AQ27304216        62025522
AQ27304216        5032465
AQ27304216        62074097

»Ý­n¦bexcel¤º§ï¬°³o¼Ëªº®æ¦¡
AQ27304209        62055202        62045456        62105993
AQ27304210        62009257        62111432        
AQ27304216        62025522        5032465        62074097

¥Ø«e°£¤F¹J¨ìVLOOKUP¥u¯à¹ï»ô¤@²Õ¸¹½X¥H¥~¡AÁÙ¦³§Ú¨S¿ìªk½T©w¦P¤@²ÕAQ¸¹½X¡A¨ì©³¥]§t1²Õ©ÎªÌ«Ü¦h²Õªº¸¹½X¡A©Ò¥H³oÆZ³Â·Ðªº
¥Ñ©ó¸ê®Æ¶q«Ü¤j¡A»Ý­n³]©w¨ç¼ÆÅý¹q¸£¦Û¤v¥h³B²z¡A¥BµLªk³]¥¨¶°(¸ê®Æ¶q¤j¡A¶]¤ÓºC)
¤£ª¾¹D¦U¦ì«e½ú¦³µL¦nªº¨ç¼Æ³]©w¤èªk?©ÎªÌexcel¦n¥Îªº¤u¨ã¥i±ÀÂË
201412-1(¥¨¶°) ½d¥»»¡©ú.zip (13.16 KB)

¥Ñ©ó¸ê®Æ¶q«Ü¤j¡A»Ý­n³]©w¨ç¼ÆÅý¹q¸£¦Û¤v¥h³B²z¡A¥BµLªk³]¥¨¶°(¸ê®Æ¶q¤j¡A¶]¤ÓºC)

¤j¶q¸ê®Æ¡A¥Îvba¬O³Ì¦n¤èªk¡A¤£¹LµLªkÀH®É§ó·s¡A¦Ó¥Î«ö¶s³B²z¡A¦ý¤£²z¸Ñ¬°¦ó¡eµLªk³]¥¨¶°¡f¡H
­Y¥Î¤½¦¡¡A°£¤F¥Î¡e»²§UÄæ¡f¥i¥Hµy·LÀu¤Æ³t«×¡Aª½±µ°}¦C¤½¦¡·|¥d¬OµLªkÁקKªº¡I

TOP

¦]¬°¤§«e¥Î¿ý»s+¥¨¶°¡A¦ý³t«×«ÜºC(¥i¯à¬O§Ú³]©wªº°ÝÃD)

¥i§_½Ðª©¥D©Î¦U¦ì¤j¤j«ü¥Ü¤@¤U¸Ó¦p¦ó¾Þ§@¡AÅý§Ú¸Õ¸Õ¬Ý

¦]¬°³oÂI§Ú¯uªº¥d¤F¦n¤[....

TOP

¸Õ¸ÕVBA, ½Ð¶K¦b¤u§@ªí"201412-1"(¤£¬OModula1)
Sub test()
    Dim sh As Worksheet
    Dim I As Integer, Lst As Integer
    Dim d, Rng As Range, E, Cnt
    Set d = CreateObject("Scripting.Dictionary")
    Set sh = Sheets("¤u§@ªí1")
    Lst = Range("A" & Rows.Count).End(xlUp).Row
    Set Rng = [A2].Resize(Lst - 1, 1)
    sh.Cells.Clear           '²M°£"¤u§@ªí1"
   
    '½Æ»s¼ÐÃD¨ì"¤u§@ªí1"(¼È©w6Äæ"³f¸¹", ¥i¦Û½Õ³Ì«á¤@­Ó6)
    [A1:B1].Copy sh.[A1]: sh.[B1].Copy sh.[B1].Resize(1, 6)
   
    For Each E In Rng
        d.Item(E.Value) = ""    '¥Î Dictionary ªº¤£­«ÂЩʿz¿ï"¸¹½X"
    Next
    sh.[A2].Resize(d.Count) = Application.Transpose(d.Keys)    '½Æ»s"¤£­«Âи¹½X" ¨ì "¤u§@ªí1"
   
    Set Rng = sh.[A2].Resize(d.Count, 1)
    ReDim Cnt(1 To d.Count) As Integer
    For I = 2 To Lst
        MH = Application.Match(Cells(I, 1), Rng)
        If Application.IsNumber(MH) Then
            Cnt(MH) = Cnt(MH) + 1
            sh.Cells(MH + 1, Cnt(MH) + 1) = Cells(I, 1).Offset(0, 1)
        End If
    Next   
End Sub

TOP

Sub TEST()
Dim Arr, Brr, T$, N&, xD, Dr, X%, i&
Arr = Range([A1], Cells(Rows.Count, 2).End(xlUp))
ReDim Brr(1 To UBound(Arr), 1 To 200)
Set xD = CreateObject("Scripting.Dictionary")
For i = 2 To UBound(Arr)
¡@¡@If Arr(i, 1) = "" Or Arr(i, 2) = "" Then GoTo 101
¡@¡@T = Arr(i, 1): Dr = xD(T)
¡@¡@If Not IsArray(Dr) Then N = N + 1: Dr = Array(N, 0): Brr(N, 1) = T
¡@¡@Dr(1) = Dr(1) + 1: If Dr(1) > X Then X = Dr(1)
¡@¡@Brr(Dr(0), Dr(1) + 1) = Arr(i, 2):  xD(T) = Dr
101: Next i
¡@
With [¤u§@ªí1!A1].Resize(N + 1, X + 1)
¡@¡@.Parent.UsedRange.Clear
¡@¡@.Cells(2, 1).Resize(N, X + 1) = Brr
¡@¡@.Item(1) = Arr(1, 1)
¡@¡@.Item(2).Resize(1, X) = "=""" & Arr(1, 2) & "-""&COLUMN(a1)"
¡@¡@.Borders.LineStyle = 1
¡@¡@Application.Goto .Item(1)
End With
End Sub
¡@
¼g±oÅo¶Û¨Ç¡A¥Î¬Ý¬Ý¡G
Xl0000127.rar (19.48 KB)
¡@

TOP

A        B
AQ27304209        
           62055202
       
AQ27304210        
           62009257
           62111432
       
AQ27304216        
           5032465
           62025522
           62074097
       
Á`­p       


¼Ï¯Ã¤ÀªR ¦n¹³¤]¥i¥H ¦ý¬O±Æ¦C¦¨¾î¦C ¦n¹³µLªk

TOP

ÁÂÁ¤j®aªºÀ°¦£¡A«áÄò¤w¸g¥i¥H¥ÎVBAÂন¾î¦¡¤F~~~~

¸U¤À·P¿E!!

¥u¤£¹L§Ú¤@­Ó¤ëªº¸ê®Æµ§¼Æ®t¤£¦h¤@¦Ê¸Uµ§¥ª¥k¡A©Ò¥H»Ý­nÂI®É¶¡¶]

¹Ä·íªìÀ³¸Ó­n¥h¾Ç¼gµ{¦¡ªº)

TOP

        ÀR«ä¦Û¦b : ÁÀ¨¥¹³¤@¦·²±¶}ªºÂAªá¡A¥~ªí¬üÄR¡A¥Í©Rµu¼È¡C
ªð¦^¦Cªí ¤W¤@¥DÃD