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

[µo°Ý] ¨D§U°}¦C°ÝÃD

¦^´_ 10# ­ã´£³¡ªL

¤£·\¬O¤j¤j¡A¥Îªºµ{¦¡½X¤ñ¤p§Ìºë²³\¦h¡A¦ý·Q­n¸ß°Ý¤@¤U¨Ï¥Î"|"¬O¦]¬°­n°Ï¹j¤£¦PÄæ¦ì¸ê®ÆªºÃö«Y¶Ü¡H

TOP

¦^´_ 11# K0l1CHEN6


²Õ§O½s¸¹ 654855
654855| > ¥D­nªºÃöÁä¦r---J=6 TO 9--- 654855|6 ~ 654855|9 --- 6~9Äæ¦U¦Û¿W¥ßªº¥[Á`
654855|S > ²Õ¦X§é¦©ªº«eºóÃöÁä¦r----654855|S6 ~ 654855|S9 --- 6~9Äæ²Õ¦X§é¦©ªºª÷ÃB

¦r¨åªºKEYS¥Î¥H¤W¤èªk, §Y¥i°Ï¤À¦U¶µ¥Øªº¥[Á`ª÷ÃB

TOP

¦^´_ 12# ­ã´£³¡ªL


°}¦Cªº¤èªk¡A¤p§Ìµo²{¦pªG¸ê®Æ¦³ªÅ®æªº¸Ü¤£·|³Q§ì¶i°}¦C¸Ì
©Ò¥H¤p§Ì¥Î¤F¤§«e§Oªº¤j¤j±Ðªº¤è¦¡¤S¦A¦¸­×§ï¤F¤@¤U¬°
  1.     k = ThisWorkbook.Sheets(1).Cells.Find(What:="*", _
  2.                 After:=Range("A1"), _
  3.                 LookAt:=xlPart, _
  4.                 LookIn:=xlFormulas, _
  5.                 SearchOrder:=xlByRows, _
  6.                 SearchDirection:=xlPrevious, _
  7.                 MatchCase:=False).Row
  8.                
  9.     Arr = sh1.Range("A2:K" & k)
½Æ»s¥N½X

TOP

¦^´_ 12# ­ã´£³¡ªL


   ·PÁ¤j¤j±Ð¾Ç¡A«D±`·PÁ¡I

TOP

¥t¥~·Q½Ð±Ð¤@¤U¡A¦r¨å©M°}¦Cªº¤è¦¡¶·­n¦p¦ó§P©w­þ¤@­Ó¬O¾A¦X¦Û¤vªº©O¡H

TOP

¥»©«³Ì«á¥Ñ °a¤ªºµ ©ó 2020-10-10 23:02 ½s¿è

¦^´_ 15# K0l1CHEN6
¦³ªÅÀ°§Ú¬Ý¤@¤U ¬O¤£¬O³o¼Ë ÁÂÁÂ
  1. Public Sub °}¦C¤À²Õ¥[Á`½m²ß()

  2. arr = Range(Cells(2, 2).End(xlDown), Cells(2, 2))
  3. Set xD = CreateObject("Scripting.Dictionary")
  4. For i = 1 To UBound(arr, 1)
  5.     For j = 1 To UBound(arr, 2)
  6.         xD(arr(i, j)) = arr(i, j)
  7.     Next j
  8. Next i
  9. Erase arr
  10. arr = Range("a1").CurrentRegion
  11. ReDim Brr(1 To UBound(arr, 1), 1 To UBound(arr, 2))

  12. For Each X In xD
  13.     ReDim Crr(1 To UBound(arr, 1), 1 To UBound(arr, 2))
  14.     If IsArray(T) Then T = ""
  15.     For A = 1 To UBound(arr, 1)
  16.         For A1 = 1 To UBound(arr, 2)
  17.             If arr(A, 2) = X Then
  18.                 Crr(A, A1) = arr(A, A1)
  19.             End If
  20.         Next A1
  21.     Next A

  22.     k = 0: k1 = 0: k2 = 0: k3 = 0
  23.     For A = 2 To UBound(Crr, 1)
  24.         If Crr(A, 4) = "²Õ¦X§é¦©" Then
  25.            T = Array(Crr(A, 6), Crr(A, 7), Crr(A, 8), Crr(A, 9))
  26.         End If
  27.         If Crr(A, 2) = X Then
  28.             If Crr(A, 4) <> "²Õ¦X§é¦©" Then
  29.                k = k + Crr(A, 6)
  30.                k1 = k1 + Crr(A, 7)
  31.                k2 = k2 + Crr(A, 8)
  32.                k3 = k3 + Crr(A, 9)
  33.             End If
  34.         End If
  35.     Next A
  36.    
  37.     For A = 2 To UBound(Crr, 1)
  38.         If Crr(A, 4) <> "²Õ¦X§é¦©" And Crr(A, 4) <> "" Then
  39.             If Crr(A, 6) <> 0 And Crr(A, 7) <> 0 And Crr(A, 8) <> 0 And Crr(A, 9) <> 0 Then
  40.                 If IsArray(T) Then
  41.                     Brr(A - 1, 1) = (T(0) * Round(Crr(A, 6) / k, 3)) + Crr(A, 6)
  42.                     Brr(A - 1, 2) = (T(1) * Round(Crr(A, 7) / k1, 3)) + Crr(A, 7)
  43.                     Brr(A - 1, 3) = (T(2) * Round(Crr(A, 8) / k2, 3)) + Crr(A, 8)
  44.                     Brr(A - 1, 4) = (T(3) * Round(Crr(A, 9) / k3, 3)) + Crr(A, 9)
  45.                 End If
  46.             End If
  47.             If Not IsArray(T) Then
  48.                 Brr(A - 1, 1) = k
  49.                 Brr(A - 1, 2) = k1
  50.                 Brr(A - 1, 3) = k2
  51.                 Brr(A - 1, 4) = k3
  52.             End If
  53.         End If
  54.     Next A
  55. Next X
  56.            
  57. Set xD = Nothing
  58. Erase arr, Crr, T
  59. Range("K2").Resize(UBound(Brr, 1), UBound(Brr, 2)) = ""
  60. Range("K2").Resize(UBound(Brr, 1), UBound(Brr, 2)) = Brr
  61.       
  62. End Sub
½Æ»s¥N½X
javascript:;

test1-A01_1010.rar (19.57 KB)

TOP

¦^´_ 15# K0l1CHEN6

­è­èµo²{ µ²ªG¸ò·Ç¤jªº¤£¤@¼Ë   ½Ð°Ý ¨S¦³§é¦©ªº²Õ§O ­n«ç»òºâ? ¥i§_Á|¦C  §Ú·Qª¾¹Dµª®× ÁÂÁÂ

TOP

¦^´_ 10# ­ã´£³¡ªL


    ÁÂÁ½׾Â,ÁÂÁ«e½ú
«á¾ÇÂǦ¹©«¾Ç²ß«e½úªº¤è®×,¤è®×¾Ç²ß¤ß±oµù¸Ñ¦p¤U,½Ð«e½ú¦A«ü¾É

¸ê®Æªí:


µ²ªGªí:



Sub TEST_A01()
Dim Arr, xD, i&, j%, N&, T$, U&
'¡ô«Å§iÅܼÆ
Set xD = CreateObject("Scripting.Dictionary")
'¡ô¥OxDÅܼƬO ¦r¨å
Sheets("¤u§@ªí2").UsedRange.EntireRow.Delete
'¡ô¥Oªí2¨Ï¥ÎÀx¦s®æ©Ò¦bªº¦C§R°£
Arr = Range([¤u§@ªí1!I1], [¤u§@ªí1!A1].Cells(Rows.Count, 1).End(xlUp))
'¡ô¥OArrÅܼƬO ¤Gºû°}¦C,¥Hªí1ªºA~IÄæÀx¦s®æ­È±a¤J°}¦C¤¤
For i = 2 To UBound(Arr)
'¡ô³]¶¶°j°é
    T = Arr(i, 2) & "|"
    '¡ô¥OTÅܼƬO²Ä2Äæ°}¦C­È³s±µ"|"²Å¸¹ªº·s¦r¦ê
    If Arr(i, 4) = "²Õ¦X§é¦©" Then T = T & "S"
    '¡ô¦pªG²Ä4Äæ°}¦C­È¬O "²Õ¦X§é¦©"¦r¦ê!´N¥OTÅܼƦA³s±µ"S"¦r¤¸
    For j = 6 To 9:  xD(T & j) = xD(T & j) + Arr(i, j):  Next
    '¡ô³]¶¶°j°é!¥OTÅܼƳs±µj°j°é¼Æªº·s¦r¦ê·íkey,
    '¨äitem­È¦U²Ö¥[jÅܼƷíÄ檺Arr°}¦C­È

Next i
'-----------------------------------
For i = 2 To UBound(Arr)
'¡ô³]¶¶°j°é
    If Arr(i, 4) = "²Õ¦X§é¦©" Then GoTo i01
    '¡ô¦pªG²Ä4Äæ°}¦C­È¬O "²Õ¦X§é¦©"¦r¦ê!´N¤£³B²z«áÄò,¸õ¨ìi01¦ì¸mÄ~Äò°õ¦æ
    T = Arr(i, 2) & "|"
    '¡ô¥OTÅܼƬO²Ä2Äæ°}¦C­È³s±µ"|"²Å¸¹ªº·s¦r¦ê,¥["|"¬O¨¾¸U¤@
    N = N + 1
    '¡ô¥ONÅܼƲ֥[1(²Ö¥[µ²ªG¦C¼Æ,¤@¶}©l´N+1¬O¬°¤FªÅ¥X¼ÐÃDªº¦C)
    For j = 1 To 5: Arr(N + 1, j) = Arr(i, j): Next
    '¡ô³]¶¶°j°é!¥OArr°}¦C±q²Ä¤G¦C¶}©l¼g¤Jµ²ªG­È(1~5Äæ)
    For j = 6 To 9
    '¡ô³]¶¶°j°é
        Arr(N + 1, j) = Arr(i, j) + Arr(i, j) * (xD(T & "S" & j) / xD(T & j))
        '¡ô¥O6~9ÄæArr°}¦C­Èµ²ªG¦C¬O
        '°j°é¦C­ÓÄæ­È+ °j°é¦C­ÓÄæ­È*(²Õ¦X§é¦©Á`ª÷ÃB/«D²Õ¦X§é¦©Á`ª÷ÃB)
        '­pºâ²Õ¦X§é¦©«á¥­§¡»ù®æ(¦]¬°²Õ¦X§é¦©­È¬O­t­È,©Ò¥H¬O¥Î¬Û¥[­pºâ)

    Next j
i01: Next i
'-----------------------------------
[¤u§@ªí2!A1:I1].Resize(N + 1) = Arr
'¡ô¥Oªí2¼g¤JArr°}¦C­È,¶W¹Lµ²ªG­Èªº°}¦C­È©¿²¤
End Sub
¥Î¦æ°Ê¸Ë¸mÂsÄý½×¾Â¾Ç²ß«Ü¤è«K,ÁÂÁ½׾¸gÀç¹Î¶¤
½Ð¤j®a¤@°_¤W½×¾Â¨Ó¥æ¬y

TOP

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


Option Explicit
Sub TEST()
Dim Brr, Y, R&, i&, j%, T$, K$
Set Y = CreateObject("Scripting.Dictionary")
Sheets("¤u§@ªí2").[A:I].ClearContents
Brr = Range([¤u§@ªí1!I1], [¤u§@ªí1!A65536].End(3))
K = "²Õ¦X§é¦©"
For i = 2 To UBound(Brr)
   T = Brr(i, 4): T = Brr(i, 2) & "|" & IIf(T = K, K, "")
   For j = 6 To 9:  Y(T & j) = Y(T & j) + Brr(i, j):  Next
Next
For i = 2 To UBound(Brr)
   If Brr(i, 4) = K Then GoTo i01
   T = Brr(i, 2) & "|"
   R = R + 1
   For j = 1 To 5: Brr(R + 1, j) = Brr(i, j): Next
   For j = 6 To 9
       Brr(R + 1, j) = Brr(i, j) + Brr(i, j) * (Y(T & K & j) / Y(T & j))
   Next j
i01: Next i
[¤u§@ªí2!A1:I1].Resize(R + 1) = Brr
Set Y = Nothing: Erase Brr
End Sub
¥Î¦æ°Ê¸Ë¸mÂsÄý½×¾Â¾Ç²ß«Ü¤è«K,ÁÂÁ½׾¸gÀç¹Î¶¤
½Ð¤j®a¤@°_¤W½×¾Â¨Ó¥æ¬y

TOP

        ÀR«ä¦Û¦b : ºÉ¦h¤Ö¥»¥÷¡A´N±o¦h¤Ö¥»¨Æ¡C
ªð¦^¦Cªí ¤W¤@¥DÃD