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

[µo°Ý] ´£¨ú½s¸¹¤¤ªº¼Æ¦r&¼Æ¦r¸É¹s

¦^´_ 8# Qin

=SUBSTITUTE(A1,"-",REPT(0,15-LEN(A1)+1))
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

¥»©«³Ì«á¥Ñ ML089 ©ó 2017-3-23 09:21 ½s¿è

¦^´_ 20# Qin

¥[¤WIF§PÂ_ DÄæ¬O§_¦³­È¡AµL­È®É¬°ªÅ¥Õ

{ =IF(D2="","",VLOOKUP(SUBSTITUTE(D2,"-","*"),IF({1,0},A$2:A$99&"",B$2:B$99),2,)) }

AÄæ¸ê®Æ¬° Table_Array ªº Index-key ³Ì¦n¯à¬O©T©wªø«×¡A²Î¤@¬°¤å¦r¡A¹ï¬d¸ß¤ñ¸û®e©ö¡C
¥Ø«e AÄæ ¦³¤å¦r¡B¼Æ¦r«¬ºA¡AIndex-keyªøµu¤£¤@­P¡A
ÁöµM ¥i¥H¥Î  «e¦r¦ê + "*" + «á¦r¦ê ¨Ó¬d¸ß¡A¦ý¤]¦³¥i¯à·|¦³»~§P±¡ªp

¨Ò¦p
A1*123¬d¸ß

¤U¦C³£¥i¥H²Å¦X¡A·|Àu¥ý¿ï¨ú²Ä¤@­Ó
A10000123
A12000123
A1A123123
{...} ªí¥Ü»Ý­n¥Î CTRL+SHIFT+ENTER ¤TÁä¿é¤J¤½¦¡

TOP

¦^´_ 22# ML089

.ÁÂÁÂ!

¨ü±Ð¤F.

TOP

¥»©«³Ì«á¥Ñ Andy2483 ©ó 2023-3-10 15:57 ½s¿è

¦^´_ 19# ML089
¦^´_ 1# cdkee


    ½×¾Â¨ì³B³£¦³Ä_ÂÃ,ÁÂÁ½׾Â,ÁÂÁ«e½ú
«á¾Ç½m²ß¦r¨å»P°}¦Cªº¤èªk,½Ð«e½ú¦A«ü¾É

°õ¦æ«e:


°õ¦æµ²ªG:


Option Explicit
Sub TEST_1()
Dim Brr, Crr, i&, T$, V%, Y, Z$, j%
Set Y = CreateObject("Scripting.Dictionary")
Brr = Range([B2], Cells(Rows.Count, "A").End(3))
Crr = Range([E2], Cells(Rows.Count, "E").End(3))
For i = 1 To UBound(Brr)
   T = Trim(Brr(i, 1)): If T = "" Then GoTo i01
   V = Len(T)
   For j = V To 1 Step -1
      If Mid(T, j, 1) <> "0" Then
         Z = Mid(T, j + 1): T = Mid(T, 1, j)
         Exit For
      End If
   Next
   T = Replace(UCase(Trim(Brr(i, 1))), "0", "") & Z
   If Y.Exists(T) = Empty Then
      Y(T) = Brr(i, 2)
      ElseIf Y(T) <> Brr(i, 2) Then
         MsgBox Brr(i, 1) & " ¥h0²¤Æ«áªº¸ê®ÆÄ榳¦P½s¸¹¤£¦P°Ó«~ºÃ¼{"
         Exit Sub
   End If
i01:
Next
For i = 1 To UBound(Crr)
   T = Trim(Crr(i, 1)): If T = "" Then GoTo i02
   V = Len(T)
   For j = V To 1 Step -1
      If Mid(T, j, 1) <> "0" Then
         Z = Mid(T, j + 1): T = Mid(T, 1, j)
         Exit For
      End If
   Next
   T = Replace(UCase(Trim(Crr(i, 1))), "0", "") & Z
   Crr(i, 1) = Y(T)
i02:
Next
[I2].Resize(UBound(Crr), 1) = Crr
Erase Brr, Brr: Set Y = Nothing
End Sub
¥Î¦æ°Ê¸Ë¸mÂsÄý½×¾Â¾Ç²ß«Ü¤è«K,ÁÂÁ½׾¸gÀç¹Î¶¤
½Ð¤j®a¤@°_¤W½×¾Â¨Ó¥æ¬y

TOP

¥»©«³Ì«á¥Ñ Andy2483 ©ó 2023-3-13 10:42 ½s¿è

¦^´_ 24# Andy2483


    ÁÂÁ½׾Â,ÁÂÁ¦U¦ì«e½ú
¤µ¤Ñ½Æ²ß¦¹ÃD,µo²{Âöº|»PÂØ­z,¤ß±oµù¸Ñ¦p¤U

Option Explicit
Sub TEST_1()
Dim Brr, Crr, Y, T$, Z$, j%, V%, i&
'¡ô«Å§iÅܼÆ:(Brr,Crr,Y)¬O³q¥Î«¬ÅܼÆ,(T,Z)¬O¦r¦êÅܼÆ,
'(j,V)¬Oµu¾ã¼ÆÅܼÆ,i¬Oªø¾ã¼ÆÅܼÆ

Set Y = CreateObject("Scripting.Dictionary")
'¡ô¥OY³o³q¥Î«¬ÅܼƬO ¦r¨å
Brr = Range([B2], Cells(Rows.Count, "A").End(3))
'¡ô¥OBrr¬O¤Gºû°}¦C,¥H[B2]¨ì AÄæ³Ì«á¦³¤º®eÀx¦s®æ,³o¨â®æ¤§¶¡©Ò¦³Àx¦s®æ­È±a¤J
Crr = Range([E2], Cells(Rows.Count, "E").End(3))
'¡ô¥OBrr¬O¤Gºû°}¦C,¥H[E2]¨ì EÄæ³Ì«á¦³¤º®eÀx¦s®æ,³o¨â®æ¤§¶¡©Ò¦³Àx¦s®æ­È±a¤J
For i = 1 To UBound(Brr)
'¡ô³]¶¶°j°é!i±q1 ¨ìBrr°}¦CÁa¦V³Ì¤j¯Á¤Þ¦C¸¹
   T = Trim(Brr(i, 1)): If T = "" Then GoTo i01
   '¡ô¥OT³o¦r¦êÅܼƬOi°j°é¦C²Ä1ÄæBrr°}¦C­È¥h°£«e«áªÅ¥Õ¦r¤¸ÅSªº·s¦r:
   '¦pªGTÅܼƬOªÅ¦r¤¸!´N¸õ¨ì i01¦ì¸mÄ~Äò°õ¦æ

   V = Len(T)
   '¡ô¥OV³oµu¾ã¼ÆÅܼƬO TÅܼƪº¦r¤¸¼Æ
   For j = V To 1 Step -1
   '¡ô³]¶¶°j°é!j±qVÅܼƨì 1,¥O¨C­Ó°j°éj³£­n-1
      If Mid(T, j, 1) <> "0" Then
      '¡ô¦pªGTÅܼƱqjÅܼƶ}©l¨ú1­Ó¦rªº¦r¤¸¤£¬O"0"
         Z = Mid(T, j + 1)
         '¡ô¥OZ³o¦r¦êÅܼƬO TÅܼƱqj+1­Ó¦r¶}©l¨ì ³Ì«á¦r¤§¶¡ªº¦r¦ê
         Exit For
         '¡ô¸õ¥Xj°j°é
      End If
   Next
   T = Replace(UCase(Trim(Brr(i, 1))), "0", "") & Z
   '¡ô¥OTÅܼƬO i°j°é¦C²Ä1ÄæBrr°}¦C­È ¥h°£«e«áªÅ¥Õ¦r¤¸,¸gÂà¤Æ­^¤å¦r¥À¬°¤j¼g,
   '¦A±N0¸m´«¬°ªÅ¦r¤¸,³Ì«á³s±µZÅÜ¼Æ ²Õ¦¨·sªº¦r¦êÅܼÆ

   If Y.Exists(T) = Empty Then
   '¡ô¦pªG¥HTÅܼƬdY¦r¨å¸Ì¨S¦³³okey?
      Y(T) = Brr(i, 2)
      '¡ô¥O¥HTÅܼƷíkey,Item¬Oi°j°é¦C²Ä2ÄæBrr°}¦C­È
      ElseIf Y(T) <> Brr(i, 2) Then
      '¡ô§_«h¦pªG¥HTÅܼƬdY¦r¨å©Ò¦^¶Ç­È¤£¦P©ó i°j°é¦C²Ä2ÄæBrr°}¦C­È??
         MsgBox Brr(i, 1) & " ¥h0²¤Æ«áªº¸ê®ÆÄ榳¦P½s¸¹¤£¦P°Ó«~ºÃ¼{"
         '¡ô¸õ¥X´£¥Üµ¡~~
         Exit Sub
         '¡ôµ²§ôµ{¦¡°õ¦æ
   End If
i01:
Next
For i = 1 To UBound(Crr)
'¡ô³]¶¶°j°é!i±q1¨ì Crr°}¦CÁa¦V³Ì¤j¯Á¤Þ¦C¸¹
   T = Trim(Crr(i, 1)): If T = "" Then GoTo i02
   '¡ô¥OTÅܼƬO i°j°é¦C²Ä1Äæ°}¦C­È¥h°£«e«áªÅ¥Õ¦r¤¸«áªº·s¦r¦ê,
   '¦pªGTÅܼƬOªÅ¦r¤¸!´N¸õ¨ì i02¦ì¸mÄ~Äò°õ¦æ

   V = Len(T)
   '¡ô¥OV³oµu¾ã¼ÆÅܼƬO TÅܼƪº¦r¤¸¼Æ
   For j = V To 1 Step -1
   '¡ô³]¶¶°j°é!j±qVÅܼƨì 1,¥O¨C­Ó°j°éj³£­n-1
      If Mid(T, j, 1) <> "0" Then
      '¡ô¦pªGTÅܼƱqjÅܼƶ}©l¨ú1­Ó¦rªº¦r¤¸¤£¬O"0"
         Z = Mid(T, j + 1)
         '¡ô¥OZ³o¦r¦êÅܼƬO TÅܼƱqj+1­Ó¦r¶}©l¨ì ³Ì«á¦r¤§¶¡ªº¦r¦ê
         Exit For
         '¡ô¸õ¥Xj°j°é
      End If
   Next
   T = Replace(UCase(Trim(Crr(i, 1))), "0", "") & Z
   '¡ô¥OTÅܼƬO i°j°é¦C²Ä1ÄæBrr°}¦C­È ¥h°£«e«áªÅ¥Õ¦r¤¸,¸gÂà¤Æ­^¤å¦r¥À¬°¤j¼g,
   '¦A±N0¸m´«¬°ªÅ¦r¤¸,³Ì«á³s±µZÅÜ¼Æ ²Õ¦¨·sªº¦r¦êÅܼÆ

   Crr(i, 1) = Y(T)
   '¡ô¥Oi°j°é¦C²Ä1ÄæCrr°}¦C­È¬O ¥HTÅܼƬdY¦r¨å©Ò¦^¶ÇªºItem­È
i02:
Next
[I2].Resize(UBound(Crr), 1) = Crr
'¡ô¥O[I2]ÂX®i¦V¤UCrr°}¦CÁa¦V³Ì¤j¯Á¤Þ¦C¸¹¼Æ ªºÀx¦s®æ½d³ò,¥HCrr°}¦C­È±a¤J
Erase Brr, Brr: Set Y = Nothing
'¡ôÄÀ©ñÅܼÆ
End Sub
¥Î¦æ°Ê¸Ë¸mÂsÄý½×¾Â¾Ç²ß«Ü¤è«K,ÁÂÁ½׾¸gÀç¹Î¶¤
½Ð¤j®a¤@°_¤W½×¾Â¨Ó¥æ¬y

TOP

        ÀR«ä¦Û¦b : ¤H¥Í¤£¤@©w²y²y¬O¦n²y¡A¦ý¬O¦³¾ú½mªº±j¥´ªÌ¡AÀH®É³£¥i¥H´§´Î¡C
ªð¦^¦Cªí ¤W¤@¥DÃD