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

[µo°Ý] ½Ð°Ý¦p¦ó§ä¥X³Ì±µªñ¤é´Á

[µo°Ý] ½Ð°Ý¦p¦ó§ä¥X³Ì±µªñ¤é´Á

¥»©«³Ì«á¥Ñ gaishutsusuru ©ó 2023-4-23 23:10 ½s¿è

¤j®a¦n¡A

·Q½Ð±Ð¦U¦ì¤j¤j¡A


°ÝÃD»¡©ú¡G
1. A1~A11¡G¬O¸ê®Æ¡A¦ý¹ê»Ú¤W¸ê®Æ·|§ó¦h
2. C1¬O¿é¤Jªº­È¡C
3. C4¬O­n³]©w¤½¦¡¡A²Å¦X¥H¤U±ø¥ó
(1) "_"©³½u«á¬Oªø«×¤£¤@¼Ëªº¦r¦ê¡C¥B¦r¦ê¤]¥i¯à·|§t¦³©³½u¡C¨Ò¡G202312_B¡CB¬O¦r¦êªºÂ²¤Æ¨Ò¤l¡A¹ê»Ú¤W¥i¯à·|¥]§t©³½u
(2) §PÂ_­n²Å¦X¦r¦ê«á¡A¤~¯à¶i¦æ¤é´Áªº§PÂ_(§ä¥X¤é´Á³Ì±µªñ¥B¤p©óC1Àx¦s®æªº±ø¥ó)¡C
(3) ¨Ò¤lÁ|¨Ò¦p¤U¡G
Æ¡ ·íC1¿é¤J¡G202312_B ®É¡AC4·|¦^¶Ç202307_B¡C(¦]¬°¦bA1~A11²Å¦X¦r¦êBªº¥B¤é´Á³Ì±µªñ¥B¤p©ó202312ªº¬O202307)
Æ¢ ·íC1¿é¤J¡G202301_A ®É¡AC4·|¦^¶Ç202212_A¡C(¦]¬°¦bA1~A11²Å¦X¦r¦êAªº¥B¤é´Á³Ì±µªñ¥B¤p©ó202301ªº¬O202212)
Æ£ ¦pªG§ä¤£¨ì¡A´N¦^¶Ç¡uµL¡v¡C¨Ò¡G·íC1¿é¤J¡G202212_A ®É¡AC4·|¦^¶Ç¡uµL¡v¡C(¦]¬°¦bA1~A11²Å¦X¦r¦êAªº¥B¤é´Á³Ì±µªñ¥B¤p©ó202212ªº¨S¦³­È)
4. ¥Ø«e¨Ï¥ÎªºEXCEL ªºª©¥»¬O2010¡B2013

³Ì«áªþ¤WÀɮסG °ÝÃD.zip (6.03 KB)

§Æ±æ¦U¦ì¤j¤j¯à©âªÅÀ°¦£¡A«D±`ÁÂÁ±z­Ì¡C

¦^´_ 11# gaishutsusuru


§â <= §ï¦¨ <

TOP

¦^´_ 9# gaishutsusuru


    ÁÂÁ½׾Â,ÁÂÁ«e½ú¦^´_
«á¾Ç¤µ¤Ñ½Æ²ß¤è®×,¤ß±oµù¸Ñ¦p¤U,½Ð«e½ú°Ñ¦Ò,½Ð¦U¦ì«e½ú«ü±Ð

Option Explicit
Function GetSerial(ST$)
'¡ô¦Û­q¨ç¼ÆGetSerial() «Å§iÅܼÆ:¿é¤J¨ç¼Æªº STÅܼƬO ¦r¦ê
Dim Brr, X, Q, Z$, K$, V0$, V1$, T0$, T1$, i&, M%, Y%
'¡ô«Å§iÅܼÆ:(Z,K,V0,V1,T0,T1)¬O¦r¦êÅܼÆ,i¬Oªø¾ã¼ÆÅܼÆ,
'(Y,M)¬Oµu¾ã¼ÆÅܼÆ,(Brr,X,Q)¬O³q¥Î«¬ÅܼÆ

Dim D As Date, P As Date, P1 As Date
'¡ô(D,P,P1)¬O¤é´ÁÅܼÆ
Brr = Range([A1], Cells(Rows.Count, 1).End(3))
'¡ô¥OBrr³o³q¥Î«¬ÅܼƬO¤Gºû°}¦C,¥H[A1]¨ìAÄæ³Ì«á¤@­Ó¦³¤º®eÀx¦s®æ­È±a¤J
T0 = ST: V0 = Mid(T0, InStr(T0, "_") + 1)
'¡ô¥OT0³o¦r¦êÅܼƬO ¨Ï¥ÎªÌ¿é¤J¨ç¼Æ¸ÌªºÀx¦s®æ­È,
'¥OV0³o¦r¦êÅܼƬO T0Åܼƨú©³½u¦r¤¸(¤£§t)«áªº©Ò¦³¦r¤¸²Õ¦¨ªº·s¦r¦ê

Y = Left(Val(T0), 4): M = Val(Right(Val(T0), 2))
'¡ô¥OY³oµu¾ã¼Æ¬O T0ÅܼÆÂà¾ã¼Æ¼Æ­È«á¨ú¥ª°¼4¦r¤¸ªº¼Æ­È,
'¡ô¥OM³oµu¾ã¼Æ¬O T0ÅܼÆÂà¾ã¼Æ¼Æ­È«á¨ú¥k°¼2¦r¤¸ªº¼Æ­È

D = CDate(Y & "/" & M & "/01")
'¡ô¥OD³o¤é´ÁÅܼƬO YÅܼƳs±µ"/",¦A³s±µMÅܼÆ,³Ì«á³s±µ"/01"²Õ¦¨ªº¤é´Á
For i = 1 To UBound(Brr)
'¡ô³]¶¶°j°é!i±q1¨ì Brr°}¦CÁa¦V³Ì¤j¯Á¤Þ¦C¸¹
   T1 = Brr(i, 1): V1 = Mid(T1, InStr(T1, "_") + 1)
   '¡ô¥OT1³o¦r¦êÅܼƬO i°j°é¦C²Ä1ÄæBrr°}¦C­È,
   '¥OV1³o¦r¦êÅܼƬO T1Åܼƨú©³½u¦r¤¸(¤£§t)«áªº©Ò¦³¦r¤¸²Õ¦¨ªº·s¦r¦ê

   Y = Left(Val(T1), 4): M = Val(Right(Val(T1), 2))
   '¡ô¥OY³oµu¾ã¼Æ¬O T1ÅܼÆÂà¾ã¼Æ¼Æ­È«á¨ú¥ª°¼4¦r¤¸ªº¼Æ­È,
   '¡ô¥OM³oµu¾ã¼Æ¬O T1ÅܼÆÂà¾ã¼Æ¼Æ­È«á¨ú¥k°¼2¦r¤¸ªº¼Æ­È

   Y = Y + M \ 12: M = M Mod 12 + 1
   '¡ô¥OYÅܼƬO ¦Û¨­+(MÅܼư£12ªº¾ã¼Æ°Ó)
   '¥OMÅܼƬO ¦Û¨­°£12«áªº¾l¼Æ,¦A+1

   P = CDate(Y & "/" & M & "/01") - 1
   '¡ô¥OP³o¤é´ÁÅܼƬO YÅܼƳs±µ"/",¦A³s±µMÅܼÆ,
   '³Ì«á³s±µ"/01"²Õ¦¨ªº«e¤@¤Ñ¤é´Á(¨D«e¤@­Ó¤ëªº³Ì«á¤@¤Ñ)

   If (T0 = T1) + (V0 <> V1) + (P > D) Then GoTo i01
   '¡ô¦pªG³o¤T­Ó±ø¥óªº¨ä¤¤¤@­Ó¤£¬O0!´N¸õ¨ì i01¦ì¸mÄ~Äò°õ¦æ
   If P1 - Date < P - Date Then
   '¡ô¦pªGP1ÅܼÆ-¤µ¤Ñ¤é´Á ¤p©ó PÅܼÆ-¤µ¤Ñ¤é´Á?
      P1 = P: Z = Format(P1, "YYYYMM") & "_" & V0
      '¡ô¥OP1ÅܼƸËPÅܼÆ,¥OZ³o¦r¦êÅܼƬO P1ÅܼÆÂà4½X¦~2½X¤ë,
      '¦A³s±µ©³½u¦r¤¸,³Ì«á³s±µV0Åܼƪº·s¦r¦ê

   End If
i01: Next
GetSerial = IIf(Z <> "", Z, "µL")
'¡ô¦^¶Ç­Èµ¹¦Û­q¨ç¼Æ:
'¦pªGZÅܼƤ£¬OªÅ¦r¤¸´N¦^¶ÇZÅܼÆ,§_«h¦^¶Ç"µL"¦r¤¸

Erase Brr
'¡ô¥OÄÀ©ñÅܼÆ
End Function
¥Î¦æ°Ê¸Ë¸mÂsÄý½×¾Â¾Ç²ß«Ü¤è«K,ÁÂÁ½׾¸gÀç¹Î¶¤
½Ð¤j®a¤@°_¤W½×¾Â¨Ó¥æ¬y

TOP

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

ÁÂÁ­㴣³¡ªL¤j¤jªºÀ°¦£¡A¤£¹L¤½¦¡¦³¨Ç·|¥X°ÝÃD¡G
¨Ò¡G
¿é¤J202307_B ®É¡A¤½¦¡À³¸Ó­n¦^¶Ç¡u202305_B¡v, ¦ý«o¸õ¥X202307_B
¿é¤J202212_A®É¡A¤½¦¡À³¸Ó­n¦^¶Ç¡uµL¡v, ¦ý«o¸õ¥X202212_A

TOP

¦^´_ 6# ML089

ÁÂÁÂML089±zªºÀ°¦£¡A¤½¦¡¨S¦³°ÝÃD®@¡C

TOP

¦^´_ 4# Andy2483

ÁÂÁÂAndy2483±zªºÀ°¦£¡A§Ú¨Ó¬ã¨s¬Ý¬Ý

TOP

¦^´_ 5# hcm19522

·PÁÂhcm19522¤j¤jªºÀ°¦£¡A¤½¦¡¥i¥H¦¨¥\¾Þ§@¡C

TOP

°}¦C¤½¦¡(¤T键)
=TEXT(MAX(--TEXT(SUBSTITUTE(A$1:A$99,MID(C1,7,9),),"[<="&LEFT(C1,6)&"]0;-1;-1;\-\1")),"0"""&MID(C1,7,9)&""";µL")

¤é´Á¦³±Æ§Ç
=IFERROR(LOOKUP(,-TEXT(SUBSTITUTE(A$1:A$99,MID(C1,7,9),),"[<="&LEFT(C1,6)&"]0;;;"),A:A),"µL")

TOP

D1 °}¦C¤½¦¡¡A¤½¦¡½Æ»s½s¿è¦C(´å¼Ð¦b¤W)¡A¥ý«öShit+Ctrl¦A«öENTER¡A¿é¤J¦¨¥\¤½¦¡¥~¼W¥[ {...}
=TEXT(MAX((MID(A$1:A$20,7,9)=MID(C1,7,9))*(LEFT(A$1:A$20,6)<LEFT(C1,6))*(0&LEFT(A$1:A$20,6))),0&""""&MID(C1,7,9)&""""&";;µL")

¥i¥H¤U©Ô
{...} ªí¥Ü»Ý­n¥Î CTRL+SHIFT+ENTER ¤TÁä¿é¤J¤½¦¡

TOP

D1{=IFERROR(INDEX(A:A,RIGHT(LARGE(IF((LEFT(A$1:A$11,6)-LEFT(C1,6)<0)*(MID(A$1:A$11,8,99)=MID(C1,8,99)),LEFT(A$1:A$11,6)/1%+ROW($1:$11)),1),2)),"µL")

11328.png (11.35 KB)

11328.png

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

TOP

        ÀR«ä¦Û¦b : ¤£­n¤p¬Ý¦Û¤v¡A¦]¬°¤H¦³µL­­ªº¥i¯à¡C
ªð¦^¦Cªí ¤W¤@¥DÃD