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

[µo°Ý] ½Ð°Ývlookup¨ç¼Æ¥iÅ|¥[¨Ï¥Î?©Î¬O»P¨ä¥¦¨ç¼Æ­n¦p¦ó¨Ï¥Î?

[µo°Ý] ½Ð°Ývlookup¨ç¼Æ¥iÅ|¥[¨Ï¥Î?©Î¬O»P¨ä¥¦¨ç¼Æ­n¦p¦ó¨Ï¥Î?

¨Ï¥Î±¡¹ÒA1:A100¦³¥H¤U³W«h¦r¦ê¡A¦]¦r¦êÁÙ±o¥ý³B²z¸Ì­±ªºªÅ¥Õ¦r¤¸¤ÎÂù¤Þ¸¹¡A©Ò¥H§Ú·Q­n§âVLOOKUP¸òCLEAN¨ç¼Æ¥[¦b¤@°_¥Î
¥H¤U¬O³W«h¥Î
abc_aac
ajdkoduoi_aaaaaac
ac_aaabe2
ae_aba_aaccc
ae_sss_aba_aaccc
¥t¤@­Ó±¡¹Ò¬O¨Ì¤W¦C¦r¦ê¥ý¤À³Î¡A"_"«áªº¦r¤¸¦A¥hvlookup¡A¦³­Ó°ÝÃD¬O¦p¦³¨â­Ó¤£¦P¦ì¸m"_",¬O§_vlookup¯à§PÂ_?

·PÁ¤j®a

mapping¸ê®Æ¤Ó¤Ö, ¥ý¸Õ//
C3//¤½¦¡
=SUBSTITUTE(SUBSTITUTE(CLEAN(A3&";"&B3),CHAR(10),)," ",)&":"&IFERROR(LOOKUP(1,0/(FIND(mapping!A$1:A$4,A3)>1),mapping!B:B),"")

TOP

¥»©«³Ì«á¥Ñ Andy2483 ©ó 2023-11-24 18:31 ½s¿è

¦^´_ 2# Ãz¨x¹F¤H


    ÁÂÁ«e½úµoªí¦¹¥DÃD»P½d¨Ò
«á¾ÇÂǦ¹©«¾Ç²ß¨ì«Ü¦hª¾ÃÑ,¾Ç²ß¤è®×¦p¤U,½Ð«e½ú°Ñ¦Ò

°õ¦æµ²ªG:



Option Explicit
Sub TEST()
Dim Brr, Z, i&, j%, c%, K, T$, T1$, T2$, T3$
Dim xR As Range, Ra As Range, Sh As Worksheet, xBook As Workbook
Set Z = CreateObject("Scripting.Dictionary")
Brr = Range([mapping!B2], [mapping!A65536].End(3))
For i = 1 To UBound(Brr): Z(Brr(i, 1)) = Brr(i, 2): Next
Brr = Range([source!B3], [source!A65536].End(3))
For i = 1 To UBound(Brr)
   T = Trim(Replace(Replace(Replace(Replace(Brr(i, 1), Chr(10), ""), Chr(9), ""), Chr(7), ""), Chr(13), ""))
   If T = "" Or (InStr(T, "_") + InStr(T, "-")) = 0 Then Brr(i, 1) = "": GoTo i01
   If InStr(T & "_", "_") > InStr(T & "-", "-") Then
      T = Left(T, InStr(T, "-") - 1) & "_" & Mid(T, InStr(T, "-") + 1)
   End If
   T1 = Left(T, InStr(T, "_"))
   T2 = Mid(T, InStr(T, "_") + 1)
   For Each K In Z.Keys:  T3 = IIf(InStr(T, K), T3 & "/" & Z(K), T3): Next
   Brr(i, 1) = T1 & T2 & ";" & Val(Brr(i, 2)) & ":" & Mid(T3, 2)
   T3 = ""
i01: Next
[C3].Resize(UBound(Brr)) = Brr
End Sub
¥Î¦æ°Ê¸Ë¸mÂsÄý½×¾Â¾Ç²ß«Ü¤è«K,ÁÂÁ½׾¸gÀç¹Î¶¤
½Ð¤j®a¤@°_¤W½×¾Â¨Ó¥æ¬y

TOP

¦^´_  Ãz¨x¹F¤H

½Ð°Ý¦¹ªþ¹Ïµ²ªG¬O±z­nªº¶Ü¡H
aer µoªí©ó 2023-9-4 11:18



   
¤£¬O¡A¹Ï¤WI64Äæ¦ì¤º®e¦³CHP-¡A³o­Ó"-"»Ý­n´«¦¨_¡A§Ú«á¨Ó§@ªk§ï¦¨¦b¥ý´M§ä¨ú¥N«á¦A¥Îvlookup¡A©Î¬O¤G¦¸¿z¿ï

¤G¦¸¿z¿ïªº·N«ä¬O²Ä¤@¦¸³B²z§¹¦r¤¸¤¤¦³"-"³B²z§¹¦b²Ä¤G¦¸³B²z

TOP

¦^´_ 2# Ãz¨x¹F¤H

½Ð°Ý¦¹ªþ¹Ïµ²ªG¬O±z­nªº¶Ü¡H

TOP

ÁÙ¦³­Ó°ÝÃDvlookup§Ú§â·j¯Á½d³ò§ï¬°table-arry®É·|§ä¤£¨ì¡A§ï¦^¹ê»ÚªºÄæ¦ì­È¥i¥H§ä¨ì

¤£¦P¤u§@ªí¨Ï¥Îtable-arry¤]¦³¤W­zª¬ªp

TOP

±¡¹Ò¥Ü·N¹Ï:

´ú¸Õ½d¨ÒÀÉ: test.zip (13.29 KB)


¤W­z°ÝÃD¤w¦³Àɮ׸ɥR~~

TOP

        ÀR«ä¦Û¦b : ¥@¤W¦³¨â¥ó¨Æ¤£¯àµ¥¡G¤@¡B§µ¶¶ ¤G¡B¦æµ½¡C
ªð¦^¦Cªí ¤W¤@¥DÃD