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

[µo°Ý] ½Ð°Ý¦p¦ó¦Û°Ê¦C¥X¸ê®Æ®w¸ê®Æ

¦^´_ 10# hcm19522

¤j¤j§A¦n
®w¦sA3 ¤U©Ô{=IFERROR("A000"&SMALL(IF(SUMIF(¸ê®Æ®w!B:B,"A000"&ROW($1:$9)-1,¸ê®Æ®w!$D:$D)-SUMIF(¥X³f!$C:$C,"A000"&ROW($1:$9)-1,¥X³f!$E:$E),ROW($1:$9)-1),ROW(A1)),"")
³o¥y¼gªk¦³­Ó°ÝÃD¡A¸U¤@§Úªº½s¸¹¶W¹L¤Qµ§(¦p¡GA0011)´NµLªk¨Ï¥Î

ÁÂÁ§A

TOP

¥»©«³Ì«á¥Ñ hcm19522 ©ó 2020-2-17 09:44 ½s¿è

¦^´_ 11# urlsyu

=IFERROR("A"&TEXT(SMALL(IF(SUMIF(¸ê®Æ®w!B:B,"A"&TEXT(ROW($1:$99)-1,"0000"),¸ê®Æ®w!$D:$D)-SUMIF(¥X³f!$C:$C,"A"&TEXT(ROW($1:$99)-1,"0000"),¥X³f!$E:$E),ROW($1:$99)-1),ROW(A1)),"0000"),"")
google"EXCEL°g"  blog  ©Îgoogleºô§}:https://hcm19522.blogspot.com/

TOP

¦^´_ 12# hcm19522

¤j¤j¦w¦w~
­è­è¸Õ¹L¡A¤£¯à¥¿½TÅã¥Ü
¬¡­¶Ã¯1.zip (33.9 KB)


¤j¤j·P®¦~

TOP

(»²§U ¨ú§å¸¹¤£­«½Æ) ¸ê®Æ®wF1 ¤U©Ô{=INDEX(B:B,MIN(IF((COUNTIF(F$1:F1,B$2:B$999)=0)*(B$2:B$999<>""),ROW($2:$999),4^8)))&""

®w¦sA3 ¤U©Ô {=IFERROR(INDEX(¸ê®Æ®w!F:F,SMALL(IF(SUMIF(¸ê®Æ®w!B:B,¸ê®Æ®w!F$2:F$99,¸ê®Æ®w!$D:$D)-SUMIF(¥X³f!$C:$C,¸ê®Æ®w!F$2:F$99,¥X³f!$E:$E),ROW($2:$99)),ROW(A1))),"")
google"EXCEL°g"  blog  ©Îgoogleºô§}:https://hcm19522.blogspot.com/

TOP

ÁÂÁ½׾Â,ÁÂÁ¦U¦ì«e½ú
«á¾ÇÂǦ¹©«¥H1#½d¨Ò½m²ß°}¦C»P¦r¨å,¾Ç²ß¤è®×¦p¤U,½Ð¦U¦ì«e½ú«ü±Ð
¸ê®Æªí:


µ²ªGªí:



Option Explicit
Sub TEST()
Dim Brr, Crr(10, 11), Z, A, i&, R&, C%, T$, T3$, T4$, xR
'¡ô«Å§iÅܼÆ
'Application.ScreenUpdating = False
Set Z = CreateObject("Scripting.Dictionary")
'¡ô¥OZÅܼƬO ¦r¨å
Brr = Range([¸ê®Æ®w!E2], [¸ê®Æ®w!A65536].End(3))
'¡ô¥OBrrÅܼƬO±a¤J½d³òÀx¦s®æ­Èªº¤Gºû°}¦C
For i = 1 To UBound(Brr)
'¡ô³]¶¶°j°é!i±q1¨ìBrr°}¦CÁa¦V³Ì¤j¯Á¤Þ¦C¸¹
   T3 = Trim(Brr(i, 3)): T4 = Trim(Brr(i, 4))
   '¡ô¥OT3ÅܼƬOi°j°é¦C²Ä3ÄæBrr°}¦C­È,¥OT4ÅܼƬOi°j°é¦C²Ä4ÄæBrr°}¦C­È
   If T3 = "" Or T4 = "" Then GoTo i01 Else T = T3 & "|" & T4
   '¡ô¦pªG³W®æ©Î§å¸¹¬OªÅªº!´N¸õ¨ì¼Ð¥Ü i01¦ì¸mÄ~Äò°õ¦æ,
   '§_«h´N¥OTÅܼƬO¥H"|"²Å¸¹³s±µT3»PT4ÅܼƲզ¨ªº·s¦r¦ê

   A = Z(T): R = Z(T & "/r"): C = Z(T & "/c")
   '¡ô¥OAÅܼƬO¥HTÅܼƬdZ¦r¨å¦^¶Çitem­È,
   '¥ORÅܼƬO¥HTÅܼƳs±µ"/r"²Õ¦¨ªº·s¦r¦ê,¬dZ¦r¨å¦^¶Çitem­È
   '¥OCÅܼƬO¥HTÅܼƳs±µ"/c"²Õ¦¨ªº·s¦r¦ê,¬dZ¦r¨å¦^¶Çitem­È

   If Not IsArray(A) Then A = Crr: A(0, 0) = "§å¸¹": A(0, 1) = T3: R = 1: Z(T & "/³W®æ") = "³W®æ" & T4
   '¡ô¦pªGAÅܼƤ£¬O°}¦C!´N¥OAÅܼƬOCrrªÅ°}¦C,¥O³Ì¥ª¤W¨¤°}¦C­È¬O "§å¸¹"¦r¦ê,
   '¥O0¦C/1Äæ°}¦C­È¬OT3ÅܼÆ(§å¸¹),¥ORÅܼƬO 1
   '¥OTÅܼƳs±µ "/³W®æ"²Õ¦¨ªº·s¦r¦ê¬°key,item¬O "³W®æ"¦r¦ê³s±µT4ÅܼƲզ¨ªº·s¦r¦ê,¯Ç¤JZ¦r¨å¤¤

   C = C + 1
   '¡ô¥OCÅܼƲ֥[ 1
   If C = 11 Then C = 1: R = R + 1
   '¡ô¦pªGCÅܼƬO 11,´N¥OC=1,R+1 (°}¦C´«¦æ©ñµ²ªG­È)
   A(R, C) = Val(Brr(i, 5))
   '¡ô¥O­«¶q­È©ñ¤J°}¦C¸Ì
   Z(T & "/r") = R: Z(T & "/c") = C: Z(T) = A
   '¡ô¥O¦C¼Æ»PÄæ¼Æ¬ö¿ý¦b¦r¨å¤¤
   '¥OA¤Gºû°}¦C©ñ¦^¦r¨å¤¤

i01: Next
Sheets("³øªí").UsedRange.EntireRow.Delete
'¡ô¥Oªºµ²ªG§R°£
Set xR = [³øªí!A1]
'¡ô¥OxRÅܼƬOª«¥ó ("³øªí"¤u§@ªíªº[A1]Àx¦s®æ)
For Each A In Z.KEYS
'¡ô³]³v¶µ°j°é!¥OAÅܼƬO Z¦r¨å¸Ìªºkey¤§¤@
   If InStr(A, "/") Then GoTo A01 Else R = Z(A & "/r")
   '¡ô¦pªGAÅܼƸ̦³¥]§t"/"¦r¤¸!´N¸õ¨ì¼Ð¥ÜA01¦ì¸mÄ~Äò°õ¦æ,§_«h´N¥ORÅܼƨú¥X¬ö¿ý¦bZ¦r¨åªº¦C¼Æ
   With xR.Resize(R + 3, 12)
   '¡ô¥H¤U¬OÃö©óµ²ªG½d³òÀx¦s®æªºµ{§Ç
      .Value = Z(A)
      '¡ô¥O¸Ó½d³òÀx¦s®æ­È,¥HAÅܼƬdZ¦r¨å¦^¶Çªº°}¦C­È¼g¤J
      .Cells(R + 3, 1) = Z(A & "/³W®æ"): .Cells(R + 3, 2) = "¼Æ¶q": .Cells(R + 3, 4) = "¤p­p:"
      '¡ô¥O¸Ó½d³òÀx¦s®æ³Ì«á¦C1,2,4ÄæÀx¦s®æ¼g¤J¦r¦ê
      .Cells(R + 3, 3) = "=COUNT(" & xR.Resize(R, 12).Offset(1).Address & ")"
      '¡ô¥O¸Ó½d³òÀx¦s®æ³Ì«á¦C²Ä3ÄæÀx¦s®æ¼g¤J «DªÅ®æªºÀx¦s®æ¼Æ¤½¦¡=COUNT()
      .Cells(R + 3, 5) = "=SUM(" & xR.Resize(R, 12).Offset(1).Address & ")"
      '¡ô¥O¸Ó½d³òÀx¦s®æ³Ì«á¦C²Ä5ÄæÀx¦s®æ¼g¤J Àx¦s®æ¼Æ­ÈÁ`©M¤½¦¡=SUM()
      For i = 7 To 10: .Borders(i).Weight = 4: Next
      '¡ô¥O¸ÓÀx¦s®æ½d³ò³Ì¥~³ò³]¬°²Ê®æ½u
   End With
   Set xR = xR(R + 4, 1)
   '¡ô¥OxRÅܼƬO¤U­Óµ²ªG½d³òªº²Ä1®æÀx¦s®æ
A01: Next
End Sub
¥Î¦æ°Ê¸Ë¸mÂsÄý½×¾Â¾Ç²ß«Ü¤è«K,ÁÂÁ½׾¸gÀç¹Î¶¤
½Ð¤j®a¤@°_¤W½×¾Â¨Ó¥æ¬y

TOP

        ÀR«ä¦Û¦b : ¡i»X½ªªº¦Û¥Ñ¡j¤H±`¦b¤°»ò³£¥i¥H¦Û¥Ñ¦Û¦bªº®É­Ô¡A«o³Q³oºØÀH¤ß©Ò±ýªº¦Û¥Ñ»X½ª¡AµêÂY®É¥ú¦Ó²@µLıª¾¡C
ªð¦^¦Cªí ¤W¤@¥DÃD