- ©«¤l
- 1446
- ¥DÃD
- 40
- ºëµØ
- 0
- ¿n¤À
- 1470
- ÂI¦W
- 0
- §@·~¨t²Î
- Windows 7
- ³nÅ骩¥»
- Excel 2010 & 2016
- ¾\ŪÅv
- 50
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥xÆW
- µù¥U®É¶¡
- 2020-7-15
- ³Ì«áµn¿ý
- 2024-10-21
|
ÁÂÁ½׾Â,ÁÂÁ¦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 |
|