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

½Ð°Ýsumif §ï¼g¦¨¦r¨å©Î¬OarrayÅý°õ¦æ³t«×ÅܧÖ

¦^´_  samwang


  «e½ú½Ð°Ý¤@¤U¦pªG¬O­n§PÂ_¨â­Ó±ø¥ó
¨Ò¦p:¥[¤J§PÂ_­Ü®w§Oªº¸Ü
s3526369 µoªí©ó 2022-9-15 09:53


¤£¤Ó¤F¸Ñ±zªº·N«ä¡A¬O³o¼Ë¶Ü?

T = Arr(i, 1) & "|" & Arr(i, ??)

TOP

¥»©«³Ì«á¥Ñ s3526369 ©ó 2022-9-15 12:56 ½s¿è

¦^´_ 11# samwang
  1. With Sheets("¤J®w©ú²Ó")
  2.     Arr = .Range(.[r1], .[o65536].End(3))
  3.     For i = 2 To UBound(Arr)
  4.         T = Arr(i, 1): xD(T) = xD(T) + Arr(i, 4) '¤J®w¦X­p
  5.     Next
  6. End With
½Æ»s¥N½X
¥Ø«e¬O §PÂ_®Æ¸¹ = ¤J®w©ú²Ó®Æ¸¹ ¥[Á`«á¶ñ¤J¨ì­Ü®w®w¦sªº¶i³f¦X­pÄæ¦ì   
§Úªº·N«ä¬O§PÂ_®Æ¸¹«áÁÙ­n¦A§PÂ_¤J®w©ú²Ó¸Ìªº­Ü®w(¤J)Äæ¦ì,²Å¦X¬O"¤½¥q­Ü"¤~¥i¥H¶ñ¤J
                          ¼Æ¶q    ,        ®Æ¸¹     ,     ®Æ¸¹       ,      ­Ü§O    ,   ­Ü§O
WorksheetFunction.SumIf(Sheets("¤J®w©ú²Ó").Range("H2:H600"), Sheets("A»Ý¨D").Cells(i, 1) ,Sheets("¤J®w©ú²Ó").Range("O2:O600"), "¤½¥q­Ü",Sheets("¤J®w©ú²Ó").Range("S2:S600") )

TOP

¥»©«³Ì«á¥Ñ Andy2483 ©ó 2022-9-15 14:19 ½s¿è

¦^´_ 4# s3526369


    ÁÂÁ«e½úµoªí¦¹¥DÃD
    ÁÂÁÂsamwang«e½ú«ü¾É
    ÁÂÁ­㴣³¡ªL«e½úªº ¦r¨å¤¤ªº¦r¨å
«á¾Ç²ß±o«Ü¦h§Þ¥©
1.¦r¨å¦W¦r°Ñ¼Æ¤Æ
2.¸ê®Æ­Ë¤J¦r¨å°j°é¤Æ
3..IIF ¨ç¼Æ¸É 0
  1. Option Explicit
  2. Sub TEST_2()
  3. Application.ScreenUpdating = False
  4. Dim x, i, QA, QB, T, S, Srr, Arr, Ac, xR, C
  5. Dim Trr, Brr, Crr, Rs, Rqs, Rqn, Ras, Ran, B
  6. T = Timer
  7. Set Srr = CreateObject("Scripting.Dictionary")
  8. Set Trr = CreateObject("Scripting.Dictionary")
  9. S = Split("¤J®w©ú²Ó,¥þ¾÷ºØBOM,A»Ý¨D,b»Ý¨D,«ü¹Ï©ú²Ó,­Ü®w®w¦s", ",")
  10. For i = 0 To UBound(S)
  11.    Set Srr(i) = Sheets(S(i))
  12.    Set Trr(i) = CreateObject("Scripting.Dictionary")
  13. Next
  14. Rs = Rows.Count
  15. Ac = Srr(5).Cells(Rs, 1).End(3).Row
  16. Arr = Range(Srr(5).[N4], Srr(5).Cells(Ac, 1))
  17. C = Array(15, 18, 16, 26, 1, 8, 1, 8, 6, 12)
  18. For i = 0 To UBound(C) Step 2
  19.    Set Rqs = Srr(i / 2).Cells(1, C(i))
  20.    Set Rqn = Srr(i / 2).Cells(Rs, C(i)).End(3)
  21.    Brr = Srr(i / 2).Range(Rqs, Rqn)
  22.    Set Ras = Srr(i / 2).Cells(1, C(i + 1))
  23.    Set Ran = Srr(i / 2).Cells(Rqn.Row, C(i + 1))
  24.    Crr = Srr(i / 2).Range(Ras, Ran)
  25.    For x = 1 To UBound(Brr)
  26.       B = Brr(x, 1)
  27.       Trr(i / 2)(B) = Trr(i / 2)(B) + Crr(x, 1)
  28.    Next
  29. Next
  30. For i = 1 To Ac - 3
  31.    xR = Arr(i, 1)
  32.    Arr(i, 5) = IIf(Trr(0)(xR), Trr(0)(xR), 0) '¤J®w¦X­p
  33.    Arr(i, 3) = IIf(Trr(1)(xR), Trr(1)(xR), 0) '¤½¥qÁ`»Ý¨D
  34.    Arr(i, 10) = IIf(Trr(2)(xR), Trr(2)(xR), 0) 'A­Ü
  35.    Arr(i, 9) = IIf(Trr(3)(xR), Trr(3)(xR), 0) 'B­Ü
  36.    Arr(i, 13) = IIf(Trr(4)(xR), Trr(4)(xR), 0) 'Á`¥X³f
  37.    QA = Arr(i, 4) + Arr(i, 5) '­Ü®w®w¦s
  38.    QB = Arr(i, 11) + Arr(i, 12)
  39.    Arr(i, 8) = QA - QB - Arr(i, 10) - Arr(i, 9) - Arr(i, 13) '¤½¥q­Ü
  40.    Arr(i, 7) = QA - QB - Arr(i, 13) 'Á`¼Æ
  41. Next i
  42. C = Array(, 3, 5, 7, 8, 9, 10, 13)
  43. For i = 1 To UBound(C)
  44.    Srr(5).Cells(4, C(i)).Resize(UBound(Arr), 1) = Application.Index(Arr, , C(i))
  45. Next
  46. Set Arr = Nothing
  47. Set Brr = Nothing
  48. Set Crr = Nothing
  49. MsgBox "¦@¯Ó®É¡G" & Timer - T & " ¬í"
  50. End Sub
½Æ»s¥N½X

TOP

¦^´_  samwang ¥Ø«e¬O §PÂ_®Æ¸¹ = ¤J®w©ú²Ó®Æ¸¹ ¥[Á`«á¶ñ¤J¨ì­Ü®w®w¦sªº¶i³f¦X­pÄæ¦ì   
§Úªº·N«ä¬O§PÂ_®Æ ...
s3526369 µoªí©ó 2022-9-15 12:46


¤£¦n·N«ä¡A¤£¤Ó¤F¸Ñ»Ý¨D¡A¥i§_ªþ¤W»¡©úºt½m¹ê»Ú¼Æ¾Ú¡AÁÂÁÂ

TOP

¦^´_ 14# samwang
¤£¦n·N«ä
­ì¥»¸ê®Æ¬Osumif §ï¦¨
  1. With Sheets("¤J®w©ú²Ó")
  2.     Arr = .Range(.[r1], .[o65536].End(3))
  3.     For i = 2 To UBound(Arr)
  4.         T = Arr(i, 1): xD(T) = xD(T) + Arr(i, 4) '¤J®w¦X­p
  5.     Next
  6. End With
½Æ»s¥N½X
¦pªG¬O´«¦¨sumifs ­n§PÂ_¨â­Ó±ø¥ó¦¨¥ßªº¸Ü

¤J®w³æ.png (93.26 KB)

¤J®w³æ.png

TOP

¦^´_ 13# Andy2483


    ÁÂÁ«e½ú,³o­Ó°õ¦æ³t«×¤]«Ü§Ö,¦ý¬O¤º®e´N¤ñ¸û½ÆÂø»Ý­n¦n¦n¦n¬ã¨s

TOP

¦^´_ 14# samwang


    §Ú­«·s¤W¶Ç§Ú­×§ï«áªºÀÉ®×
     §Ú¦³¼W¥[¤F¨Ç±ø¥ó

­Ü®w¦X­pTEST.rar (592.53 KB)

TOP

¦^´_ 12# s3526369


    ½Ð±Ð«e½ú:
1.Sheets("¤J®w©ú²Ó").Range("H2:H600") ³oÄæ¦ì¬OÁôÂæӥB³Q«OÅ@¤F
2.Sheets("¤J®w©ú²Ó").Àx¦s®æ[H2]¤º®e¬O   1501343¤½¥q­Ü   !¸ò¦¹¥DÃD¬O¤°»òÃö«Y?
3.³o WorksheetFunction.SumIfsªº­È­n©ñ­þ¸Ì?

TOP

¦^´_ 18# Andy2483


    §Ú¦³­«·s­×§ï¤F
Àɮצb17¼Ó
¥i¥H¬Ý¬Ý
ÁÂÁÂ

TOP

¦^´_  samwang
¤£¦n·N«ä
­ì¥»¸ê®Æ¬Osumif §ï¦¨¦pªG¬O´«¦¨sumifs ­n§PÂ_¨â­Ó±ø¥ó¦¨¥ßªº¸Ü
s3526369 µoªí©ó 2022-9-15 14:43

¬O³o¼Ë¶Ü? ½Ð´ú¸Õ¬Ý¬Ý¡AÁÂÁÂ
With Sheets("¤J®w©ú²Ó")
    Arr = .Range(.[S1], .[o65536].End(3))
    For i = 2 To UBound(Arr)
        If Arr(i, 5) = "¤½¥q­Ü" Then '¬O¤½¥q­Ü-->³fª«½s¸¹²Ö¥[RÄ檺Qty
            T = Arr(i, 1): xD(T) = xD(T) + Arr(i, 4) '¤J®w¦X­p
        End If
    Next
End With

TOP

        ÀR«ä¦Û¦b : ¥¬¬I¦p¼½ºØ¡A¥HÅw³ß¤ß´þ¼íºØ¤l¡A¤~·|µoªÞ¡C
ªð¦^¦Cªí ¤W¤@¥DÃD