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

[µo°Ý] ¦C¥X¥ý¶i¥ý¥X°T®§

[µo°Ý] ¦C¥X¥ý¶i¥ý¥X°T®§

¦U¦ì¤j¤j


§Ú·Q¦C¥X¦³ÃC¦âªº³¡¤À°T®§

­n¨Ì¬y¤ô¸¹¨Ì§Ç¸ò®w¦s¨ú¸ê®Æ¡A¨Cµ§¸ê®Æ·|¿W¥ß­pºâ¨Ã®ø¯Ó®w¦s¼Æ

½Ð¦U¦ì¤j¤jµ¹§ÚÂI´£¥Ü¡A·PÁÂ

test.zip (10.14 KB)

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


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

Option Explicit
Sub TEST()
Dim Arr, Brr, Crr, »Ý¨D&, Z, i&, j%, C%, T$, ®w¦s&, D As Date, W&, V&, R&
Set Z = CreateObject("Scripting.Dictionary")
Brr = Range([®w¦s!C1], [®w¦s!A65536].End(3))
For i = 2 To UBound(Brr)
   T = Trim(Brr(i, 1)): If T = "" Then GoTo i01
   If Not IsObject(Z(T)) Then Set Z(T) = CreateObject("Scripting.Dictionary")
   Z(T)(i) = 0: Z(T & "Tot") = Z(T & "Tot") + Val(Brr(i, 3))
i01: Next
Crr = Range([­ì©l!C1], [­ì©l!A65536].End(3))
ReDim Arr(2 To UBound(Crr), 1 To 100)
For i = 2 To UBound(Crr)
   T = Trim(Crr(i, 2)): »Ý¨D = Val(Crr(i, 3)): C = 0: If Z(T & "Tot") = 0 Then GoTo i02
   For j = Z(T & "No") To Z(T).Count - 1
      W = W + 1: R = Z(Trim(Crr(i, 2))).keys()(j)
      ®w¦s = Val(Brr(R, 3))
      D = CDate(Brr(Z(Trim(Crr(i, 2))).keys()(j), 2))
      V = IIf(®w¦s < »Ý¨D, ®w¦s, »Ý¨D)
      Arr(i, C + 1) = D: Arr(i, C + 2) = V: C = C + 2
      Z(T & "Tot") = Z(T & "Tot") - V
      »Ý¨D = »Ý¨D - V: ®w¦s = ®w¦s - V
      If ®w¦s = 0 Then Z(T & "No") = Z(T & "No") + 1 Else Brr(R, 3) = ®w¦s
      If »Ý¨D = 0 Then Exit For
   Next
i02: If Z(T & "Tot") = 0 And »Ý¨D > 0 Then Arr(i, C + 1) = "¨S¦³¸ê®Æ": Arr(i, C + 2) = "¼Æ¶q¤£¨¬"
Next
[­ì©l!D2].Resize(UBound(Arr) - 1, UBound(Arr, 2)) = Arr
MsgBox "°j°é¼Æ:" & W
End Sub
¥Î¦æ°Ê¸Ë¸mÂsÄý½×¾Â¾Ç²ß«Ü¤è«K,ÁÂÁ½׾¸gÀç¹Î¶¤
½Ð¤j®a¤@°_¤W½×¾Â¨Ó¥æ¬y

TOP

¥»©«³Ì«á¥Ñ hcm19522 ©ó 2024-1-31 17:10 ½s¿è

(¿é¤J½s¸¹10769-1) googleºô§}:https://draft.blogger.com/blog/posts/9094075214774179359
google"EXCEL°g"  blog  ©Îgoogleºô§}:https://hcm19522.blogspot.com/

TOP

¦^´_ 11# n7822123


¦]¹ïexcel¤½¦¡¦³¨Ç¸gÅç, ©Ò¥Hµ{¦¡½X¤¤ºU¤J¤F¤½¦¡§Þ¥©,
ÁöµM¬Ý°_¨Óµu, ¦ý®Ä²v¤Î©öŪ©Ê¤£¤@©w´N¤ñ¸û¦n!
¨ä¹êµ{¦¡½X³Ì¦n¬O®Ä²v­ÝÅU©öŪ©Ê, §Q¤_¥H«áªº­×§ï¡C

¦]±NÅܼƩw¸q¬°¾ã¼Æ, ©Ò¥H¥Îval(???) ¨ÓÁ׿ù,
¤]¥i¤Ö¤@¦¸IFªº§PÂ_~~ IF ISNUMERIC(ARR(I,3)) THEN

TOP

¥»©«³Ì«á¥Ñ n7822123 ©ó 2020-4-4 05:19 ½s¿è

¦^´_ 4# n7822123


¬Ý¤F·Ç¤j¼gªºµ{¦¡¡A§Úµo²{¡A§Ú¼gªºÁÙ¯u¬O¤¾ªø.......

§Ú¤]­n¾Ç¾Ç¥u¥Î¦r¨å¬ö¿ý¦C¸¹¡A¦Ó¤£¬O§â¸ê®Æ¤@ªÑ¸£ªº¶ë¶i¦r¨åXD

¤£¹L·Ç¤j¥Î¤F¤£¤Ö¤p§Þ¥©¡A­nŪÀ´¥i¯à¤ñ¸ûÃø¤@ÂIÂI

(¦p¦^Ū²Ä¤@¦C¸ê®Æ¡A¥Î val ¨ç¼Æ§â¯Â¦r¦êÅܦ¨¼Æ¦r0)

µ{¦¡¬O¨Ì»Ý¨D¼gªº¡A»Ý¨Dªí¹F¤£²M·¡
©ÎªÌ¨S¦³¤W¶Çªþ¥ó¡A·R²ö¯à§U

TOP

¦^´_ 9# qaqa3296

If ®w¦s = 0 Then TR(k) = ""
_¦pªG®w¦s=0, ±N­ì¦³[¦æ¸¹]Åܦ¨ªÅ¦r²Å

xD(Brr(i, 1)) = Trim(Join(TR, " "))
__Join(TR, " ") ­«·s±Nsplitªº°}¦C¥H[ªÅ¥Õ¦r¤¸]²Õ¦¨¦r¦ê
__Trim(Join(TR, " "))...§Q¥ÎTrim¥h±¼¦r¦ê«e«áªºªÅ¥Õ¦r¤¸, Åܦ¨·s¦r¦ê(¦r¦ê·|¶V¨Ó¶Vµu,¬Æ¦Ü¬°ªÅ)

TOP

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

·PÁ­㴣³¡ªL¤j¤j´£¨Ñ¨ä¥L¤è¦¡

¯àµy·L¸ÑÄÀ·s¼W³o¨â¦æªºÅÞ¿è¶Ü?

If ®w¦s = 0 Then TR(k) = ""
xD(Brr(i, 1)) = Trim(Join(TR, " "))

TOP

µy­×¤@¤U, ­Y¸ê®Æ¸û¦h, ¥i´î¤Ö¤£¥²­nªº°j°é:
Xl0000064-V2.rar (17.54 KB)

TOP

¤é´Á¥²¶·¬O¥Ñ¤p¦Ó¤j±Æ§Çªº~~
µ{¦¡½X²¤Æ¤£¤F, ºCºC¬Ý§a!
  1. Sub TEST()
  2. Dim Arr, Brr, Crr, xD, i&, k%, R&, C%, »Ý¨D&, ®w¦s&, V&, TR, Mx&
  3. Set xD = CreateObject("Scripting.Dictionary")
  4. Arr = Range([®w¦s!C1], [®w¦s!A65536].End(xlUp))
  5. For i = 2 To UBound(Arr)
  6.     xD(Arr(i, 1)) = Trim(xD(Arr(i, 1)) & " " & i)
  7. Next i
  8. '---------------------------------
  9. Brr = Range([C2], [B65536].End(xlUp))
  10. ReDim Crr(1 To UBound(Brr), 1 To 100)
  11. For i = 1 To UBound(Brr)
  12.     C = 1:  »Ý¨D = Brr(i, 2)
  13.     TR = Split(Trim(xD(Brr(i, 1)) & " 1"), " ")
  14.     For k = 0 To UBound(TR)
  15.         ®w¦s = Val(Arr(TR(k), 3)):   If ®w¦s = 0 Then GoTo k01
  16.         V = IIf(®w¦s < »Ý¨D, ®w¦s, »Ý¨D)
  17.         Crr(i, C) = CDate(Arr(TR(k), 2)):  Crr(i, C + 1) = V
  18.         »Ý¨D = »Ý¨D - V:   ®w¦s = ®w¦s - V:   Arr(TR(k), 3) = ®w¦s
  19.         C = C + 2
  20. k01: Next k
  21.      If »Ý¨D > 0 Then Crr(i, C) = "¨S¦³¸ê®Æ": Crr(i, C + 1) = "¼Æ¶q¤£¨¬"
  22. Next i
  23. [D2].Resize(UBound(Crr), 100) = Crr
  24. End Sub
½Æ»s¥N½X
Xl0000064.rar (14.91 KB)


================================

TOP

¦^´_ 4# n7822123

·PÁ n7822123 ¤j¤jªº¦^´_

³oµ{¦¡½X¤w¹F¨ì»Ý¨D

¬Ý°_¨Ó²LÅã©öÀ´¡A¥¿¦n¥i¥H¾Ç²ß¤@¤U

#¤]·PÁÂikboy¤j¤jªº¦^´_

§R°£²Ä¤G¦æ¨ÌÂÂ¥X²{¿ù»~

°õ¦æ¶¥¬q¿ù»~'1004':

°»¿ùÅã¬O¦b  .Resize(n, 3) = b ³o¦æ

¦ý§Ú¬Ý¤£À´ikboy¤j¤jªºµ{¦¡½X¡A©Ò¥HµLªk¦Û¦æ°£¿ù

TOP

        ÀR«ä¦Û¦b : ¡i¬°µ½Ävª§¡j¤H¥Í­n¬°µ½Ävª§¡A¤À¬í¥²ª§¡C
ªð¦^¦Cªí ¤W¤@¥DÃD