{"id":5747,"date":"2019-10-28T00:26:04","date_gmt":"2019-10-27T16:26:04","guid":{"rendered":"http:\/\/www.brofive.org\/?p=5747"},"modified":"2019-11-07T00:56:34","modified_gmt":"2019-11-06T16:56:34","slug":"excel%e4%b8%advlookup%e7%9a%84%e4%b8%a4%e4%b8%aa%e4%bd%bf%e7%94%a8%e5%b0%8f%e9%97%ae%e9%a2%98","status":"publish","type":"post","link":"http:\/\/www.brofive.net\/?p=5747","title":{"rendered":"Excel\u4e2dVLookup\u7684\u4e24\u4e2a\u4f7f\u7528\u5c0f\u95ee\u9898"},"content":{"rendered":"<p><span style=\"font-size: large;\">\u65e9\u5c31\u77e5\u9053VLookup\u662fExcel\u91cc\u9762\u6700\u91cd\u8981\u7684\u4e00\u4e2a\u51fd\u6570\uff08\u636e\u8bf4\u5df2\u7ecf\u6709\u4e2a\u65b0\u7684XLookup\u66ff\u4ee3\u8005\uff09\uff0c\u7528\u4e8e\u5728\u4e00\u5757\u6570\u636e\u4e2d\uff0c\u6309\u7167\u67d0\u4e2a\u5217\u67e5\u627e\u6570\u636e\uff0c\u4eca\u5929\u6b63\u597d\u9047\u5230\u7c7b\u4f3c\u95ee\u9898\uff0c\u67e5\u8be2\u4e86\u4e00\u4e0b\u5fae\u8f6f\u6587\u6863\uff08<\/span><a title=\"https:\/\/docs.microsoft.com\/zh-cn\/office\/vba\/api\/excel.worksheetfunction.vlookup\" href=\"https:\/\/docs.microsoft.com\/zh-cn\/office\/vba\/api\/excel.worksheetfunction.vlookup\"><span style=\"font-size: large;\">https:\/\/docs.microsoft.com\/zh-cn\/office\/vba\/api\/excel.worksheetfunction.vlookup<\/span><\/a><span style=\"font-size: large;\">\uff09\uff0c\u4e00\u4e0b\u5b50\u5c31\u7528\u4e0a\u4e86\uff0c\u975e\u5e38\u7b80\u5355\uff0c\u4f46\u662f\u9047\u5230\u4e862\u4e2a\u5c0f\u95ee\u9898\uff0c\u8bb0\u5f55\u4e0b\u6765\uff1a<\/span><\/p>\n<p><strong><span style=\"font-size: large;\">\u4e00\u3001\u5728\u7cbe\u786e\u67e5\u627e\u4e00\u4e2a\u5de5\u53f7\u7684\u65f6\u5019\uff0c\u53d1\u73b0\u660e\u660e\u6570\u636e\u662f\u5bf9\u7684\uff0c\u4f46\u662f\u67e5\u627e\u4e0d\u5230<\/span><\/strong><\/p>\n<p><span style=\"font-size: large;\">\u516c\u5f0f\uff1a<em>VLOOKUP(<span style=\"color: #ff0000;\">D6<\/span>,<span style=\"color: #ff0000;\">MySheet!$C$1:$C$202<\/span>,1, FALSE)<\/em><\/span><\/p>\n<p><span style=\"font-size: large;\">\u4ed4\u7ec6\u7814\u7a76\u624d\u53d1\u73b0\uff0c\u539f\u6765\u662f\u6570\u636e\u5757<span style=\"color: #ff0000;\">MySheet!$C$1:$C$202<\/span>\u4e2d\uff0c\u5de5\u53f7\u7684\u540e\u9762\u6709\u7a7a\u683c\uff0c\u9020\u6210\u5339\u914d\u5931\u8d25\uff0c\u5982\u679c\u4e00\u4e2a\u4e00\u4e2a\u5220\u9664\uff0c\u663e\u7136\u53c8\u592a\u590d\u6742\uff0c\u7136\u540e\u5c31\u7528\u4e86\u4e00\u4e0bUE\u7684\u5217\u6a21\u5f0f\uff0c\u8fc5\u901f\u641e\u5b9a<\/span><\/p>\n<p><strong><span style=\"font-size: large;\">\u4e8c\u3001VLookup\u5728\u67e5\u627e\u4e0d\u5230\u7684\u65f6\u5019\uff0c\u8fd4\u56de\u503c\u662fNA\uff0c\u5339\u914d\u6210\u529f\u5219\u8fd4\u56de\u539f\u503c\uff0c\u9700\u8981\u4f7f\u7528\u4e00\u4e2aExcel\u7684ISNA\uff08\uff09\u51fd\u6570\u6765\u8f6c\u5316\u4e00\u4e0b<\/span><\/strong><\/p>\n<p><span style=\"font-size: large;\">\u516c\u5f0f\uff1a<em>=IF(<span style=\"color: #ff0000;\">ISNA<\/span>(VLOOKUP(D6,MySheet!$C$1:$C$202,1, FALSE)), &#8220;&#8221;, 1)<\/em><\/span><\/p>\n<p><span style=\"font-size: large;\">\u5176\u5b9e\u8fd9\u4e2aVLookup\u57fa\u672c\u4e0a\u7c7b\u4f3c\u4e8eSQL\u7684 <em>Select xxx from Table where col=xxx<\/em>\uff0c\u6bd4\u8f83\u597d\u5947\u7684\u662f\uff0c\u5982\u679cExcel\u4e2d\u5982\u679c\u6bcf\u4e2a\u5404\u81ea\u90fd\u8981\u8ba1\u7b97\uff0c\u800c\u4e14\u8981\u5b9e\u65f6\u66f4\u65b0\uff0c\u5f88\u53ef\u80fd\u7528\u4e86\u7279\u6b8a\u7684\u6570\u636e\u7ed3\u6784<\/span><\/p>\n<p><span style=\"font-size: large;\">\u5fae\u8f6f\u6587\u6863\uff1a<\/span><a title=\"https:\/\/docs.microsoft.com\/zh-cn\/office\/vba\/api\/excel.worksheetfunction.vlookup\" href=\"https:\/\/docs.microsoft.com\/zh-cn\/office\/vba\/api\/excel.worksheetfunction.vlookup\"><span style=\"font-size: large;\">https:\/\/docs.microsoft.com\/zh-cn\/office\/vba\/api\/excel.worksheetfunction.vlookup<\/span><\/a><\/p>\n<h4><span style=\"font-size: large;\">\u8bed\u6cd5<\/span><\/h4>\n<p><span style=\"font-size: large;\"><em>\u8868\u8fbe\u5f0f<\/em>\u3002<strong>VLookup<\/strong>(<em>Arg1<\/em>\u3001 <em>Arg2<\/em>\u3001 <em>Arg3<\/em>\u3001 <em>Arg4<\/em>)<\/span><\/p>\n<p><span style=\"font-size: large;\">_\u8868\u8fbe\u5f0f_\u4e00\u4e2a\u4ee3\u8868**<\/span><a href=\"https:\/\/docs.microsoft.com\/zh-cn\/office\/vba\/api\/excel.worksheetfunction\"><span style=\"font-size: large;\">WorksheetFunction<\/span><\/a><span style=\"font-size: large;\">** \u5bf9\u8c61\u7684\u53d8\u91cf\u3002<\/span><\/p>\n<h4><span style=\"font-size: large;\">\u53c2\u6570<\/span><\/h4>\n<p><span style=\"font-size: large;\">\u540d\u79f0<br \/>\n\u5fc5\u9700\/\u53ef\u9009<br \/>\n\u6570\u636e\u7c7b\u578b<br \/>\n\u8bf4\u660e<\/span><\/p>\n<p><span style=\"font-size: large;\"><em>Arg1<\/em><br \/>\n\u5fc5\u9700<br \/>\n<strong>Variant<\/strong><br \/>\nLookup_value &#8211; \u8981\u5728\u8868\u6570\u7ec4\u7684\u7b2c\u4e00\u5217\u4e2d\u641c\u7d22\u7684\u503c\u3002 Lookup_value \u53ef\u4ee5\u662f\u4e00\u4e2a\u503c\uff0c\u4e5f\u53ef\u4ee5\u662f\u4e00\u4e2a\u5f15\u7528\u3002 \u5982\u679c lookup_value \u5c0f\u4e8e table_array \u7b2c\u4e00\u5217\u4e2d\u7684\u6700\u5c0f\u503c, \u5219<strong>VLookup<\/strong>\u5c06\u8fd4\u56de #N \u7684\/a \u9519\u8bef\u503c\u3002<\/span><\/p>\n<p><span style=\"font-size: large;\"><em>Arg2<\/em><br \/>\n\u5fc5\u9700<br \/>\n<strong>Variant<\/strong><br \/>\nTable_array &#8211; \u4e24\u5217\u6216\u66f4\u591a\u5217\u7684\u6570\u636e\u3002 \u4f7f\u7528\u5bf9\u533a\u57df\u6216\u533a\u57df\u540d\u79f0\u7684\u5f15\u7528\u3002 table_array \u7684\u7b2c\u4e00\u5217\u4e2d\u7684\u503c\u662f\u6309 lookup_value \u641c\u7d22\u5f97\u5230\u7684\u503c\u3002 \u8fd9\u4e9b\u503c\u53ef\u4ee5\u662f\u6587\u672c\u3001\u6570\u5b57\uff0c\u4e5f\u53ef\u4e3a\u903b\u8f91\u503c\u3002 \u6587\u672c\u4e0d\u533a\u5206\u5927\u5c0f\u5199\u3002<\/span><\/p>\n<p><span style=\"font-size: large;\"><em>Arg3<\/em><br \/>\n\u5fc5\u9700<br \/>\n<strong>Variant<\/strong><br \/>\nCol_index_num &#8211; \u5fc5\u987b\u4ece\u4e2d\u8fd4\u56de\u5339\u914d\u503c\u7684 table_array \u4e2d\u7684\u5217\u6570\u3002 \u5982\u679c col_index_num \u4e3a 1\uff0c\u5219\u8fd4\u56de table_array \u7684\u7b2c\u4e00\u5217\u4e2d\u7684\u503c\uff1b\u5982\u679c col_index_num \u4e3a 2\uff0c\u5219\u8fd4\u56de table_array \u7684\u7b2c\u4e8c\u5217\u4e2d\u7684\u503c\uff0c\u4f9d\u6b64\u7c7b\u63a8\u3002<\/span><\/p>\n<p><span style=\"font-size: large;\"><em>Arg4<\/em><br \/>\n\u53ef\u9009<br \/>\n<strong>Variant<\/strong><br \/>\nRange_lookup-\u4e00\u4e2a\u903b\u8f91\u503c, \u7528\u4e8e\u6307\u5b9a\u662f\u5e0c\u671b<strong>VLookup<\/strong>\u65b9\u6cd5\u67e5\u627e\u7cbe\u786e\u5339\u914d\u503c\u8fd8\u662f\u8fd1\u4f3c\u5339\u914d\u9879\u3002<\/span><\/p>\n<h4><span style=\"font-size: large;\">\u8fd4\u56de\u503c<\/span><\/h4>\n<p><strong><span style=\"font-size: large;\">Variant<\/span><\/strong><\/p>\n<h4><span style=\"font-size: large;\">\u8bf4\u660e<\/span><\/h4>\n<p><span style=\"font-size: large;\"><strong>VLookup<\/strong> \u4e2d\u7684 V \u8868\u793a\u5782\u76f4\u65b9\u5411\u3002 \u5f53\u6bd4\u8f83\u503c\u4f4d\u4e8e\u8981\u67e5\u627e\u7684\u6570\u636e\u5de6\u4fa7\u7684\u5217\u65f6\uff0c\u53ef\u4f7f\u7528 <strong>VLookup<\/strong> \u65b9\u6cd5\uff0c\u800c\u4e0d\u662f <strong><a href=\"https:\/\/docs.microsoft.com\/zh-cn\/office\/vba\/api\/excel.worksheetfunction.hlookup\">HLookup<\/a><\/strong> \u65b9\u6cd5\u3002<\/span><\/p>\n<p><span style=\"font-size: large;\">\u5982\u679c Col_index_num \u5c0f\u4e8e 1\uff0c\u5219 <strong>VLookup<\/strong> \u65b9\u6cd5\u5c06\u751f\u6210\u9519\u8bef\u3002<\/span><\/p>\n<p><span style=\"font-size: large;\">\u5982\u679c Col_index_num \u5927\u4e8e table_array \u4e2d\u7684\u5217\u6570\uff0c\u5219 <strong>VLookup<\/strong> \u65b9\u6cd5\u5c06\u751f\u6210\u9519\u8bef\u3002<\/span><\/p>\n<p><span style=\"font-size: large;\">\u5982\u679c Range_lookup \u4e3a<strong>True<\/strong>\u6216\u88ab\u7701\u7565, \u5219\u8fd4\u56de\u7cbe\u786e\u5339\u914d\u6216\u8fd1\u4f3c\u5339\u914d\u3002 \u5982\u679c\u627e\u4e0d\u5230\u7cbe\u786e\u5339\u914d\u503c\uff0c\u5219\u8fd4\u56de\u4e0b\u4e00\u4e2a\u5c0f\u4e8e lookup_value \u7684\u6700\u5927\u503c\u3002 table_array \u7684\u7b2c\u4e00\u5217\u4e2d\u7684\u503c\u5fc5\u987b\u6309\u964d\u5e8f\u6392\u5217\uff1b\u5426\u5219\uff0c<strong>VLookup<\/strong> \u65b9\u6cd5\u53ef\u80fd\u4e0d\u4f1a\u8fd4\u56de\u6b63\u786e\u7684\u503c\u3002<\/span><\/p>\n<p><span style=\"font-size: large;\">\u5982\u679c Range_lookup \u4e3a<strong>False<\/strong>, \u5219<strong>VLookup<\/strong>\u65b9\u6cd5\u5c06\u4ec5\u67e5\u627e\u5b8c\u5168\u5339\u914d\u9879\u3002 \u5728\u672c\u4f8b\u4e2d\uff0c\u65e0\u9700\u5bf9 table_array \u7684\u7b2c\u4e00\u5217\u4e2d\u7684\u503c\u8fdb\u884c\u6392\u5e8f\u3002 \u5982\u679c table_array \u7684\u7b2c\u4e00\u5217\u4e2d\u7684\u4e24\u4e2a\u6216\u66f4\u591a\u503c\u4e0e lookup_value \u76f8\u5339\u914d\uff0c\u5219\u4f7f\u7528\u6240\u627e\u5230\u7684\u7b2c\u4e00\u4e2a\u503c\u3002 \u5982\u679c\u627e\u4e0d\u5230\u7cbe\u786e\u5339\u914d\u503c\uff0c\u5219\u751f\u6210\u9519\u8bef\u3002<\/span><\/p>\n<p><span style=\"font-size: large;\">\u5728 table_array \u7684\u7b2c\u4e00\u5217\u4e2d\u641c\u7d22\u6587\u672c\u503c\u65f6, \u8bf7\u786e\u4fdd table_array \u7684\u7b2c\u4e00\u5217\u4e2d\u7684\u6570\u636e\u6ca1\u6709\u524d\u5bfc\u7a7a\u683c\u3001\u5c3e\u968f\u7a7a\u683c\u3001\u76f4<code>'<\/code> (or <code>\"<\/code>) \u548c\u5377\u66f2 (<code>\u2018<\/code>\u6216<code>\u201c<\/code>) \u5f15\u53f7\u7684\u4f7f\u7528\u4e0d\u4e00\u81f4\u6807\u8bb0\u6216\u975e\u6253\u5370\u5b57\u7b26\u3002 \u5728\u8fd9\u4e9b\u60c5\u51b5\u4e0b, <strong>VLookup<\/strong>\u65b9\u6cd5\u53ef\u80fd\u4f1a\u7ed9\u51fa\u4e0d\u6b63\u786e\u6216\u610f\u5916\u7684\u503c\u3002 \u8981\u4e86\u89e3\u5982\u4f55\u6e05\u7406\u6216\u526a\u88c1\u503c\uff0c\u8bf7\u53c2\u9605 <strong><a href=\"https:\/\/docs.microsoft.com\/zh-cn\/office\/vba\/api\/excel.worksheetfunction.clean\">Clean<\/a><\/strong> \u548c <strong><a href=\"https:\/\/docs.microsoft.com\/zh-cn\/office\/vba\/api\/excel.worksheetfunction.trim\">Trim<\/a><\/strong> \u65b9\u6cd5\u3002<\/span><\/p>\n<p><span style=\"font-size: large;\">\u5728\u641c\u7d22\u6570\u5b57\u6216\u65e5\u671f\u503c\u65f6\uff0c\u8bf7\u786e\u4fdd table_array \u7b2c\u4e00\u5217\u4e2d\u7684\u6570\u636e\u672a\u5b58\u50a8\u4e3a\u6587\u672c\u503c\u3002 \u5728\u6b64\u60c5\u51b5\u4e0b\uff0c<strong>VLookup<\/strong> \u65b9\u6cd5\u53ef\u80fd\u7ed9\u51fa\u4e0d\u6b63\u786e\u6216\u975e\u9884\u671f\u7684\u503c\u3002<\/span><\/p>\n<p><span style=\"font-size: large;\">\u5982\u679c range_lookup \u4e3a<strong>False<\/strong>\u4e14 lookup_value \u4e3a\u6587\u672c, \u5219\u53ef\u4ee5\u5728 lookup_value \u4e2d\u4f7f\u7528\u901a\u914d\u7b26\u3001\u95ee\u53f7 (?) \u548c\u661f\u53f7 (*)\u3002 \u95ee\u53f7\u53ef\u5339\u914d\u4efb\u610f\u7684\u5355\u4e2a\u5b57\u7b26\uff1b\u661f\u53f7\u53ef\u5339\u914d\u4efb\u610f\u4e00\u4e32\u5b57\u7b26\u3002 \u5982\u679c\u8981\u67e5\u627e\u5b9e\u9645\u7684\u95ee\u53f7\u6216\u661f\u53f7\uff0c\u5219\u8bf7\u5728\u8be5\u5b57\u7b26\u524d\u952e\u5165\u4e00\u4e2a\u6ce2\u5f62\u7b26 (~)\u3002<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u65e9\u5c31\u77e5\u9053VLookup\u662fExcel\u91cc\u9762\u6700\u91cd\u8981\u7684\u4e00\u4e2a\u51fd\u6570\uff08\u636e\u8bf4\u5df2\u7ecf\u6709\u4e2a\u65b0\u7684XLookup\u66ff\u4ee3\u8005\uff09\uff0c\u7528\u4e8e\u5728\u4e00\u5757\u6570\u636e&#8230;<\/p>\n","protected":false},"author":1,"featured_media":5749,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[284,149,308],"tags":[245,715],"views":3338,"_links":{"self":[{"href":"http:\/\/www.brofive.net\/index.php?rest_route=\/wp\/v2\/posts\/5747"}],"collection":[{"href":"http:\/\/www.brofive.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.brofive.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.brofive.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.brofive.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5747"}],"version-history":[{"count":3,"href":"http:\/\/www.brofive.net\/index.php?rest_route=\/wp\/v2\/posts\/5747\/revisions"}],"predecessor-version":[{"id":5765,"href":"http:\/\/www.brofive.net\/index.php?rest_route=\/wp\/v2\/posts\/5747\/revisions\/5765"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/www.brofive.net\/index.php?rest_route=\/wp\/v2\/media\/5749"}],"wp:attachment":[{"href":"http:\/\/www.brofive.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5747"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.brofive.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5747"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.brofive.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5747"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}