"Vlookup" and "Match" in VBA
- ©«¤l
- 56
- ¥DÃD
- 8
- ºëµØ
- 0
- ¿n¤À
- 81
- ÂI¦W
- 0
- §@·~¨t²Î
- Window7
- ³nÅ骩¥»
- OFFICE2010
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2011-6-25
- ³Ì«áµn¿ý
- 2016-1-17
|
¬Ý¤F¤W±ªº©«¤l¡A¹ï©ó¨ç¼Æ¨Ï¥Î©óVBA ÁÙ¬O¤@ª¾¥b¸Ñ
¤£ª¾¥i§_±N±`¥Îªº¨ç¼Æ²Õ¦X¹B¥Î©ó VBA §e²{¡A°t¦X¦Û©w¸q¨ç¼Æ¨Ï¥Î
¦ýÀ³¸Ó¬O¹ï©ó¸ê®Æ§ÎºAÁÙ¤£¤F¸Ñ¡A¦A¥[¤W¨ç¼Æªº¼gªk§ó¬Oè¥Î
©Ò¥H¼g¤F¤@ÓÀ³¸Ó¬O¿ù»~¤£¤Ö¡A§ï¤F¼Æ¦¸³£¶Ã¤FÃÐ
¦pªþ¥ó¡A§Æ±æ¦³¥ý¶i¥i¥H¨ó§U¤@¤U¬Ý¬O§_¥i¦æ
¨ç¼Æ²Õ¦X¬°
=IF(ISNA(VLOOKUP($A2,³]³Æ²M³æ!$A$1:$B$20,MATCH(D$1,³]³Æ²M³æ!A$1:B$1,0),0)),"µL³]³Æ¸ê®Æ",(VLOOKUP($A2,³]³Æ²M³æ!$A$1:$B$20,MATCH(D$1,³]³Æ²M³æ!A$1:B$1,0),0)))
§Æ±æ§e²{
=vlmatch($A2,E$1,µL³]³Æ¸ê®Æ,³]³Æ²M³æ!$A$1:$B$20,³]³Æ²M³æ!$A$1:$B$1)
vlmatch ¬°¦Û©w¸q¨ç¼Æ¡A¥u»Ý¿é¤J $A2,E$1,µL³]³Æ¸ê®Æ,³]³Æ²M³æ!$A$1:$B$20,³]³Æ²M³æ!$A$1:$B$1§Y¥i
§ï¤F¼Æ¦¸¡A³Ì«á¿ù»~¡A¼g¤F¦p¤U- Public Function VLMatch(tt$, KK$, NN$, DALL As Range, dt As Range) As String
- Dim i%, j$, k As Boolean
- i = Evaluate("Match(kk, dt, 0)")
- j = Evaluate("VLookup(tt, DALL, i, 0)")
- k = Evaluate("IsNA(j)")
- If k = False Then
- VLMatch = NN
- Else
- VLMatch = j
- End If
-
- End Function
½Æ»s¥N½X
¦Û©w¸q¨ç¼Æ VLOOK+Match.rar (108.68 KB)
|
|
|
|
|
|
|
- ©«¤l
- 56
- ¥DÃD
- 8
- ºëµØ
- 0
- ¿n¤À
- 81
- ÂI¦W
- 0
- §@·~¨t²Î
- Window7
- ³nÅ骩¥»
- OFFICE2010
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2011-6-25
- ³Ì«áµn¿ý
- 2016-1-17
|
¥»©«³Ì«á¥Ñ Happkkevin ©ó 2011-7-17 12:00 ½s¿è
¦^´_ Happkkevin
GBKEE µoªí©ó 2011-7-17 08:45 
GBKEE ª©¤j¡A¯uªº¬O¤Ó¼F®`Åo
¨C¨C§Úªá¤F³\¤[®É¶¡×¥¿¥un¸g¹L¦¹³B¥ý¶iªº«ü¾É
¤£¥u°ÝÃD¸Ñ¨M¡A§óÅý§Ú¾Ç¨ì³\¦h
¦Ü©óVBA¥i¥Î¨ç¼Æ¤§«e§Ú¨S¦³½T»{¥u¬O if µo¥Í°ÝÃD¤~³B²z
»¡©ú¤¤ §Úªº³nÅéÃö©ó vlookup »P match ¨S¦³»¡©ú¡A¦ý§Ú·QÀ³¸Ó¬O»P¨ç¼Æ¬Û¦P
·PÁ§Aªº«ü¾É
×¥¿¬°§Aªº»yªk¥[¤W×¥¿ NN¿é¤J""§Y²Å¦X§Úªº»Ý¨D
=vlmatch($A2,E$1,"µL³]³Æ¸ê®Æ",³]³Æ²M³æ!$A$1:$B$20,³]³Æ²M³æ!$A$1:$B$1) |
|
|
|
|
|
|