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

vba ²Ö¥[°ÝÃD

vba ²Ö¥[°ÝÃD

½Ð±Ð¦U¦ì°ª¤â, ³o­Ó¸Ó«ç»ò¼g, ·Q¤£¥X¨Ó:( ¬¡­¶Ã¯2.rar (649.04 KB)
¦pªþ¥ó, ·Q§â¦P¤@¬íªº¼Æ¶q²Ö¥[, ¤Î³Ì«á¤@­Ó»ù®æ©M»P²Ä¤@­Ó»ù®æ¬Û´î
®É¶¡               »ù®æ                                          ¼Æ¶q
8450100        b14-b2=-2                          sum(c2:c14)=38

®É¶¡               »ù®æ       ¶q
8450100        7232        4
8450100        7229        2
8450100        7229        2
8450100        7228        4
8450100        7228        2
8450100        7228        2
8450100        7227        2
8450100        7227        2
8450100        7226        2
8450100        7226        2
8450100        7228        6
8450100        7231        4
8450100        7230        4
ªì¾ÇªÌcolor

ÁÂÁ½׾Â,ÁÂÁ¦U¦ì«e½ú
«á¾ÇÂǦ¹©«½m²ß°}¦C»P¦r¨å,²K¥[³Ì§C»ù/³Ì°ª»ù/§¡»ù,½Ð¦U¦ì«e½ú«ü±Ð

°õ¦æµ²ªG:



Option Explicit
Sub TEST_1()
Dim Brr, Y, N&, S&, i&, j&, T&, T2&, T3&
Dim xR As Range, Ra As Range, Sh As Sheets
Set Y = CreateObject("Scripting.Dictionary")
Set xR = Range([F1], Cells(Rows.Count, "A").End(xlUp))
Brr = xR: N = 1
For i = 2 To UBound(Brr)
   T = Brr(i, 1): T2 = Brr(i, 2): T3 = Brr(i, 3)
   If Y(T) = "" Then
      N = N + 1: Y(T) = N: S = N: Brr(N, 1) = T: Brr(N, 3) = T3
      Y(T & "|sd") = T2: Y(T & "|mi") = T2: Y(T & "|ma") = T2
      Else
         N = Y(T): Brr(N, 3) = Brr(N, 3) + T3
         Y(T & "|mi") = IIf(T2 > Y(T & "|mi"), Y(T & "|mi"), T2)
         Y(T & "|ma") = IIf(T2 < Y(T & "|ma"), Y(T & "|ma"), T2)
   End If
   Y(T & "|q") = Y(T & "|q") + T3: Y(T & "|tot") = Y(T & "|tot") + (T2 * T3)
   Brr(N, 2) = T2 - Y(T & "|sd")
   Brr(N, 4) = Y(T & "|mi"): Brr(N, 5) = Y(T & "|ma")
   Brr(N, 6) = Y(T & "|tot") / Y(T & "|q")
Next
With xR.Offset(, 15)
   .EntireColumn.ClearContents: .Resize(S, 6) = Brr
   .Item(1, 4).Resize(1, 3) = [{"³Ì§C»ù","³Ì°ª»ù","§¡»ù"}]
End With
Set Y = Nothing: Set xR = Nothing: Erase Brr
End Sub
¥Î¦æ°Ê¸Ë¸mÂsÄý½×¾Â¾Ç²ß«Ü¤è«K,ÁÂÁ½׾¸gÀç¹Î¶¤
½Ð¤j®a¤@°_¤W½×¾Â¨Ó¥æ¬y

TOP

¦^´_ 1# color790


    ÁÂÁ½׾Â,ÁÂÁ«e½úµoªí¦¹¥DÃD»P½d¨Ò,ÁÂÁ¦U¦ì«e½ú
«á¾ÇÂǦ¹©«½m²ß°}¦C»P¦r¨å,¾Ç²ßªº¤è®×¦p¤U,½Ð¦U¦ì«e½ú«ü±Ð

°õ¦æ«e:


°õ¦æµ²ªG:



Option Explicit
Sub TEST()
Dim Brr, Y, N&, i&, j&, T&, T2&, T3&
Dim xR As Range, Ra As Range, Sh As Sheets
Set Y = CreateObject("Scripting.Dictionary")
Set xR = Range([C1], Cells(Rows.Count, "A").End(xlUp))
Brr = xR: N = 1
For i = 2 To UBound(Brr)
   T = Brr(i, 1): T2 = Brr(i, 2): T3 = Brr(i, 3)
   If Y(T) = "" Then
      N = N + 1: Y(T) = N: Brr(N, 1) = T: Brr(N, 3) = T3
      Y(T & "|sd") = T2: Brr(N, 2) = T2 - Y(T & "|sd")
      Else
         Brr(Y(T), 2) = T2 - Y(T & "|sd")
         Brr(Y(T), 3) = Brr(Y(T), 3) + T3
   End If
Next
With xR.Offset(, 15)
   .EntireColumn.ClearContents: .Resize(N, 3) = Brr
End With
Set Y = Nothing: Set xR = Nothing: Erase Brr
End Sub
¥Î¦æ°Ê¸Ë¸mÂsÄý½×¾Â¾Ç²ß«Ü¤è«K,ÁÂÁ½׾¸gÀç¹Î¶¤
½Ð¤j®a¤@°_¤W½×¾Â¨Ó¥æ¬y

TOP

·PÁª©¥DªºÀ°¦£, ¦Û¤v­n¦n¦n¥Î¥\®ø¤Æ¤@¤U....
ªì¾ÇªÌcolor

TOP

¦^´_ 9# color790
  1. Sub ex()
  2. Set d = CreateObject("Scripting.Dictionary")  '¬ö¿ýB¡BCÄ檺­È
  3. Set d1 = CreateObject("Scripting.Dictionary")  '°O¿ý¨C¬í²Ä¤@­Ó¥X²{ªºªº»ù®æ

  4. For Each a In Range([A2], [A2].End(xlDown))  '¦bAÄæ¦ì°µ°j°é
  5.    If d.exists(a.Value) = False Then  '¦pªGAªº­È¨S³Q°O¿ý¦bd¦r¨å¤º
  6.       d1(a.Value) = a.Offset(, 1).Value  '°O¦í¨C¬í²Ä¤@­Ó¥X²{ªºªº»ù®æ
  7.       d(a.Value) = Array(d1(a.Value) - a.Offset(, 1).Value, a.Offset(, 2).Value) '±NB¡BCÄ檺­È°O¿ý¨ìd¦r¨å¤º
  8.       Else
  9.       ar = d(a.Value)  '¨ú¥Xd¦r¨å¹ïÀ³ªº¤º®e
  10.       ar(0) = a.Offset(, 1).Value - d1(a.Value)  '§âBÄ檺­È´î±¼¹ïÀ³AÄ檺­È(²Ä¤@¦¸¥X²{ªº­È)
  11.       ar(1) = ar(1) + a.Offset(, 2).Value  'CÄæ¦ì¥[¤W«e¥[Á`ªº­È
  12.       d(a.Value) = ar  '§â°}¦C¦^¦s¨ì¦r¨å¤¤
  13.     End If
  14. Next
  15. [F2].Resize(d.Count, 1) = Application.Transpose(d.keys)  '§â¨C¬íªº¦r¦ê(¦r¨å¯Á¤Þ­È)¼g¤J
  16. [G2].Resize(d.Count, 2) = Application.Transpose(Application.Transpose(d.items))  '§â¦r¨å¤º®e¼g¤J
  17. End Sub
½Æ»s¥N½X
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

´N¬OÅý¥¦¦Û¤v´î¦Û¤v©Î¬Oª½±µÅã¥Ü¬°0, ÁÂÁª©¥Dªº¦^µª
ªì¾ÇªÌcolor

TOP

¦^´_ 7# color790


¥u¦³¤@µ§¸ê®Æ, ©Ò¥H¥¦¥u·|Åã¥Ü¬Û¹ïªº»ù®æ, ³o­Ó¦³¸Ñ¶Ü?

­n¸Ñ¬Æ»ò?
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

¦^´_  color790


    ­ì¥»A26:A44¬O8450300¦@19µ§¸ê®Æ
±Æ§Ç«áÅܦ¨A30:A50¬O8450300¦@21µ§¸ê®Æ
Hsieh µoªí©ó 2011-10-25 00:08


¶â........§ÚÀ´¤F, ­ì¨Ó¬O¸ê®Æ§Ú¦³¾ã²z, ©Ò¥H¦³³o­Ó°ÝÃD
¥t¥~¦A°Ý¤@¤U, ¨Ò¦p8451500 ³o­Ó®É¶¡, ¥Ñ©ó¥¦¥u¦³¤@µ§¸ê®Æ, ©Ò¥H¥¦¥u·|Åã¥Ü¬Û¹ïªº»ù®æ, ³o­Ó¦³¸Ñ¶Ü?
ªì¾ÇªÌcolor

TOP

¦^´_ 5# color790


    ­ì¥»A26:A44¬O8450300¦@19µ§¸ê®Æ
±Æ§Ç«áÅܦ¨A30:A50¬O8450300¦@21µ§¸ê®Æ
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

¦^´_  color790




    §AAÄ檺¸ê®Æ¨S¦³§¹¥þ¸s²Õ¨ì
­«·s±Æ§Ç¹L§A´N·|µo²{
Hsieh µoªí©ó 2011-10-24 23:36




ª©¥D,§Ú¤£¤ÓÀ´¸s²Õ¨ìªº·N«ä? ­«·s±Æ§Ç«á, µ²ªG¦n¹³¬O¤@¼Ë......
ªì¾ÇªÌcolor

TOP

        ÀR«ä¦Û¦b : §g¤l¬°¥Ø¼Ð¡A¤p¤H¬°¥Øªº¡C
ªð¦^¦Cªí ¤W¤@¥DÃD