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

[µo°Ý] ¦C¥X¤£¬Û¦P¼Æ­È©Î¦r¦ê¥X²{¦¸¼Æ

[µo°Ý] ¦C¥X¤£¬Û¦P¼Æ­È©Î¦r¦ê¥X²{¦¸¼Æ

¥»©«³Ì«á¥Ñ jesscc ©ó 2019-8-4 09:53 ½s¿è

°ÝÃD¦bªþ¥ó±Ô­z
[attach]31120[/attach]

test.rar (7.25 KB)

Jess

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

°õ¦æ«e:


°õ¦æµ²ªG:



Option Explicit
Sub TEST_1()
Dim Brr, Crr, Y, R&, i&, j%, N&, T1$, T2$, V1&, V2&
Set Y = CreateObject("Scripting.Dictionary")
[E2:F2000].ClearContents
Brr = Range([B7], Cells(Rows.Count, 1).End(3))
ReDim Crr(1 To UBound(Brr), 1 To 2)
For i = 1 To UBound(Brr)
   T1 = Brr(i, 1): T2 = Brr(i, 2)
   If T1 = "" Or Val(T2) = 0 Then GoTo i01
   V1 = Val(T2): V2 = StrReverse(Split(StrReverse(T2), "-")(0))
   For j = V1 To V2
      If Y(T1) = "" Then N = N + 1: Y(T1) = N: Crr(N, 1) = T1
      If Y(T1 & j) = "" Then
         R = Y(T1): Y(T1 & j) = 1: Crr(R, 2) = Crr(R, 2) + 1
      End If
   Next
i01: Next
If N > 0 Then [E2].Resize(N, 2) = Crr
Set Y = Nothing: Erase Brr, Crr
End Sub
¥Î¦æ°Ê¸Ë¸mÂsÄý½×¾Â¾Ç²ß«Ü¤è«K,ÁÂÁ½׾¸gÀç¹Î¶¤
½Ð¤j®a¤@°_¤W½×¾Â¨Ó¥æ¬y

TOP

¦^´_ 10# jesscc


    ©ñ¤j¨ú >=5  µ²ªG¤@¼Ë   5   9   99    999   §¡¥i
google"EXCEL°g"  blog  ©Îgoogleºô§}:https://hcm19522.blogspot.com/

TOP

hcm19522 µoªí©ó 2019-8-5 12:29


h¤j,§Ú¬Ý¤F±zªº¤½¦¡¡A¦³¤@ÂI¤£©ú¥Õ,´N¬O
E7:E17=IF(ISERR(FIND("-",D7)),(COUNTIFS($A$7:A7,A7,D$7:D7,D7)=1)*1,MID(D7,FIND("-",D7)+1,9)-LEFT(D7,FIND("-",D7)-1)+1)
¨ä¤¤¨º­Ó9¬O¤°»ò·N«ä?DÄ檺¸ê®Æ¡AÁ`¦r¤¸ªø«×¤£¬O³Ì¦h¤]¥u¦³5­Ó¦r¤¸¶Ü?
Jess

TOP

google"EXCEL°g"  blog  ©Îgoogleºô§}:https://hcm19522.blogspot.com/

TOP

ºØÃþ¨ä¹ê¤£¬O¤ôªG¡A¥u¦³¤T¤jÃþ¡C
¤p§ÌVBA«Ü²Ê²L¡A§Ú¬O²Ä¤@¦¸¬Ý¨ì¤½¦¡·f°tµ{¦¡³o¼Ëªº¼gªk¡C
·Q½Ð°Ý­ã¤j
GetCount ¬O¦Û©w¸q¨ç¼Æªº¦WºÙ¶Ü?
If Arr(i, 1) <> C Or Val(Brr(i, 1)) = 0 ³o¤@¬q§¹¥þ¬Ý¤£À´
¯à½Ð­ã¤j±Ð¤@¤U¶Ü?
Jess

TOP

¥H¤Uµ{¦¡½X©ñ¦b¤@¯ë¼Ò²Õ:
Function GetCount(xA As Range, xB As Range, C$)
Dim Arr, Brr, xD, i&, j&, B
Set xD = CreateObject("Scripting.Dictionary")
Arr = xA: Brr = xB
For i = 1 To UBound(Arr)
    If Arr(i, 1) <> C Or Val(Brr(i, 1)) = 0 Then GoTo 101
    B = Split(Brr(i, 1) & "-" & Brr(i, 1), "-")
    For j = B(0) To B(1):  xD(j) = 1:  Next j
101: Next
GetCount = xD.Count
End Function


D3/¤½¦¡:
=IF(B3="","",GetCount(A$7:A$20,D$7:D$20,B3))


¸ê®Æ¦hªº¸Ü, À³¸Ó·|¥d
===============================

TOP

¦^´_ 5# jesscc


³o¬O¹ê»Úªí®æ???
ºØÃþ©T©w¥u¦³3ºØ???

TOP

­ìªí®æ¦pªþ¥ó
test1.rar (7.53 KB)
Jess

TOP

¦^´_ 3# jesscc


¤½¦¡¬O¨S¿ìªk,
ªí®æ¬O¤°»ò¼Ë???  ¤W¶Ç¬Ý¬Ý~~

TOP

        ÀR«ä¦Û¦b : ¤H¥Í³Ì¤jªº¦¨´N¬O±q¥¢±Ñ¤¤¯¸°_¨Ó¡C
ªð¦^¦Cªí ¤W¤@¥DÃD