{"id":138414,"date":"2024-04-28T13:11:20","date_gmt":"2024-04-28T05:11:20","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/138414.html"},"modified":"2024-04-28T13:11:22","modified_gmt":"2024-04-28T05:11:22","slug":"excel%e8%a1%a8%e6%a0%bc%e6%95%b0%e6%8d%ae%e6%80%8e%e4%b9%88%e6%9b%bf%e6%8d%a2","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/138414.html","title":{"rendered":"excel\u8868\u683c\u6570\u636e\u600e\u4e48\u66ff\u6362"},"content":{"rendered":"<p style=\"text-align:center\"><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/24134054\/c7c79cf9-7379-4745-b880-f57b75d20d2e.webp\" alt=\"excel\u8868\u683c\u6570\u636e\u600e\u4e48\u66ff\u6362\" \/><\/p>\n<p><p><strong>Excel\u8868\u683c\u6570\u636e\u66ff\u6362<\/strong>\u53ef\u4ee5\u901a\u8fc7\u591a\u79cd\u65b9\u6cd5\u5b9e\u73b0\uff0c\u4e3b\u8981\u5305\u62ec<strong>\u4f7f\u7528\u67e5\u627e\u548c\u66ff\u6362\u529f\u80fd\u3001\u5229\u7528\u516c\u5f0f\u8fdb\u884c\u66ff\u6362\u3001\u4ee5\u53ca\u8fd0\u7528VBA\u4ee3\u7801\u6765\u81ea\u52a8\u66ff\u6362\u6570\u636e\u3002<\/strong> \u5728\u8fd9\u51e0\u79cd\u65b9\u6cd5\u4e2d\uff0c\u4f7f\u7528\u67e5\u627e\u548c\u66ff\u6362\u529f\u80fd\u662f\u6700\u76f4\u63a5\u4e14\u5e38\u7528\u7684\u65b9\u6cd5\uff0c\u5b83\u5141\u8bb8\u7528\u6237\u5feb\u901f\u5b9a\u4f4d\u548c\u66f4\u6362\u8868\u683c\u4e2d\u7684\u7279\u5b9a\u6570\u636e\uff0c\u6781\u5927\u5730\u63d0\u9ad8\u4e86\u5de5\u4f5c\u6548\u7387\u3002<\/p>\n<\/p>\n<p><p>\u4ee5\u67e5\u627e\u548c\u66ff\u6362\u529f\u80fd\u4e3a\u4f8b\uff0c\u8be5\u529f\u80fd\u4e0d\u4ec5\u53ef\u4ee5\u66ff\u6362\u6587\u672c\uff0c\u8fd8\u80fd\u66ff\u6362\u6570\u5b57\u3001\u65e5\u671f\u7b49\u5404\u79cd\u6570\u636e\u7c7b\u578b\u3002\u7528\u6237\u53ef\u4ee5\u901a\u8fc7\u7b80\u5355\u51e0\u6b65\u64cd\u4f5c\u5b8c\u6210\u66ff\u6362\u4efb\u52a1\uff1a\u9996\u5148\u9009\u62e9\u9700\u8981\u66ff\u6362\u6570\u636e\u7684\u8303\u56f4\uff0c\u7136\u540e\u6253\u5f00\u201c\u67e5\u627e\u548c\u66ff\u6362\u201d\u5bf9\u8bdd\u6846\uff0c\u8f93\u5165\u60f3\u8981\u67e5\u627e\u7684\u5185\u5bb9\u53ca\u66ff\u6362\u540e\u7684\u5185\u5bb9\uff0c\u6700\u540e\u70b9\u51fb\u201c\u5168\u90e8\u66ff\u6362\u201d\u5373\u53ef\u3002\u8fd9\u4e2a\u8fc7\u7a0b\u53ef\u4ee5\u7cbe\u786e\u5feb\u901f\u5730\u66ff\u6362\u5927\u91cf\u6570\u636e\uff0c\u975e\u5e38\u9002\u7528\u4e8e\u5904\u7406\u590d\u6742\u7684\u6570\u636e\u8868\u683c\u3002<\/p>\n<\/p>\n<p><h2>\u4e00\u3001\u4f7f\u7528\u67e5\u627e\u548c\u66ff\u6362\u529f\u80fd<\/h2>\n<\/p>\n<p><p>Excel\u7684\u67e5\u627e\u548c\u66ff\u6362\u529f\u80fd\u975e\u5e38\u5f3a\u5927\uff0c\u5b83\u4e0d\u4ec5\u80fd\u591f\u66ff\u6362\u6587\u672c\uff0c\u8fd8\u53ef\u4ee5\u66ff\u6362\u6570\u5b57\u3001\u65e5\u671f\u3001\u516c\u5f0f\u7b49\u3002\u8981\u8bbf\u95ee\u8fd9\u4e2a\u529f\u80fd\uff0c\u53ef\u4ee5\u5728\u201c\u5f00\u59cb\u201d\u9009\u9879\u5361\u4e2d\u627e\u5230\uff0c\u6216\u8005\u4f7f\u7528\u5feb\u6377\u952eCtrl+H\u6253\u5f00\u3002<\/p>\n<\/p>\n<p><h3>\u67e5\u627e\u548c\u66ff\u6362\u7684\u57fa\u672c\u64cd\u4f5c<\/h3>\n<\/p>\n<p><p>\u6253\u5f00\u67e5\u627e\u548c\u66ff\u6362\u7a97\u53e3\u540e\uff0c\u4f60\u53ef\u4ee5\u6307\u5b9a\u67e5\u627e\u8303\u56f4\u3001\u67e5\u627e\u5185\u5bb9\u4ee5\u53ca\u66ff\u6362\u4e3a\u7684\u5185\u5bb9\u3002\u4f8b\u5982\uff0c\u5047\u8bbe\u4f60\u60f3\u5c06\u8868\u683c\u4e2d\u6240\u6709\u7684\u201c2019\u201d\u66ff\u6362\u4e3a\u201c2020\u201d\uff0c\u53ea\u9700\u5728\u201c\u67e5\u627e\u5185\u5bb9\u201d\u6846\u4e2d\u8f93\u5165\u201c2019\u201d\uff0c\u5728\u201c\u66ff\u6362\u4e3a\u201d\u6846\u4e2d\u8f93\u5165\u201c2020\u201d\uff0c\u7136\u540e\u70b9\u51fb\u201c\u5168\u90e8\u66ff\u6362\u201d\u6309\u94ae\u3002<\/p>\n<\/p>\n<p><h3>\u9ad8\u7ea7\u9009\u9879\u548c\u6280\u5de7<\/h3>\n<\/p>\n<p><p>\u67e5\u627e\u548c\u66ff\u6362\u529f\u80fd\u8fd8\u63d0\u4f9b\u4e86\u4e00\u4e9b\u9ad8\u7ea7\u9009\u9879\uff0c\u5982\u53ea\u66ff\u6362\u6574\u4e2a\u5355\u5143\u683c\u5185\u5bb9\u3001\u5339\u914d\u5927\u5c0f\u5199\u7b49\u3002\u8fd9\u4e9b\u9ad8\u7ea7\u529f\u80fd\u4f7f\u67e5\u627e\u548c\u66ff\u6362\u5de5\u4f5c\u66f4\u52a0\u7cbe\u786e\u3002\u53e6\u5916\uff0c\u4f7f\u7528\u901a\u914d\u7b26\uff08\u5982*\u548c?\uff09\u4e5f\u80fd\u5b9e\u73b0\u66f4\u7075\u6d3b\u7684\u67e5\u627e\u66ff\u6362\u7b56\u7565\u3002<\/p>\n<\/p>\n<p><h2>\u4e8c\u3001\u5229\u7528\u516c\u5f0f\u8fdb\u884c\u66ff\u6362<\/h2>\n<\/p>\n<p><p>\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0c\u4f7f\u7528\u516c\u5f0f\u66ff\u6362\u6570\u636e\u80fd\u591f\u63d0\u4f9b\u66f4\u591a\u7684\u7075\u6d3b\u6027\u548c\u63a7\u5236\u3002\u8fd9\u79cd\u65b9\u6cd5\u9002\u7528\u4e8e\u6309\u7279\u5b9a\u89c4\u5219\u66ff\u6362\u6570\u636e\uff0c\u4f8b\u5982\u5c06\u67d0\u4e2a\u5b57\u6bb5\u4e2d\u7684\u4e00\u90e8\u5206\u6587\u672c\u66ff\u6362\u6389\u3002<\/p>\n<\/p>\n<p><h3>\u4f7f\u7528SUBSTITUTE\u51fd\u6570<\/h3>\n<\/p>\n<p><p><code>SUBSTITUTE<\/code>\u51fd\u6570\u53ef\u4ee5\u66ff\u6362\u6587\u672c\u4e2d\u7684\u7279\u5b9a\u5b57\u7b26\u6216\u6587\u672c\u4e32\u3002\u5176\u57fa\u672c\u8bed\u6cd5\u4e3a <code>SUBSTITUTE(text, old_text, new_text, [instance_num])<\/code>\uff0c\u5176\u4e2d<code>instance_num<\/code>\u662f\u53ef\u9009\u7684\uff0c\u8868\u793a\u66ff\u6362\u7b2c\u51e0\u6b21\u51fa\u73b0\u7684<code>old_text<\/code>\u3002<\/p>\n<\/p>\n<p><h3>\u7ed3\u5408IF\u51fd\u6570\u8fdb\u884c\u6761\u4ef6\u66ff\u6362<\/h3>\n<\/p>\n<p><p>\u6709\u65f6\uff0c\u6211\u4eec\u53ef\u80fd\u53ea\u60f3\u5728\u6ee1\u8db3\u7279\u5b9a\u6761\u4ef6\u65f6\u624d\u8fdb\u884c\u66ff\u6362\u3002\u6b64\u65f6\uff0c\u53ef\u4ee5\u5c06<code>SUBSTITUTE<\/code>\u51fd\u6570\u4e0e<code>IF<\/code>\u51fd\u6570\u7ed3\u5408\u4f7f\u7528\uff0c\u5b9e\u73b0\u6761\u4ef6\u66ff\u6362\u903b\u8f91\u3002<\/p>\n<\/p>\n<p><h2>\u4e09\u3001\u8fd0\u7528VBA\u4ee3\u7801\u81ea\u52a8\u66ff\u6362\u6570\u636e<\/h2>\n<\/p>\n<p><p>\u5bf9\u4e8e\u4e00\u4e9b\u590d\u6742\u7684\u66ff\u6362\u64cd\u4f5c\uff0c\u6216\u8005\u9700\u8981\u9891\u7e41\u6267\u884c\u66ff\u6362\u4efb\u52a1\u7684\u60c5\u51b5\uff0c\u4f7f\u7528VBA\u4ee3\u7801\u81ea\u52a8\u5316\u66ff\u6362\u8fc7\u7a0b\u53ef\u80fd\u662f\u4e00\u4e2a\u66f4\u597d\u7684\u9009\u62e9\u3002<\/p>\n<\/p>\n<p><h3>\u7f16\u5199VBA\u66ff\u6362\u811a\u672c<\/h3>\n<\/p>\n<p><p>\u901a\u8fc7VBA\uff0c\u6211\u4eec\u53ef\u4ee5\u7f16\u5199\u811a\u672c\u6765\u67e5\u627e\u5e76\u66ff\u6362\u5de5\u4f5c\u7c3f\u4e2d\u7684\u6570\u636e\u3002\u7f16\u5199VBA\u811a\u672c\u9700\u8981\u4e00\u5b9a\u7684\u7f16\u7a0b\u77e5\u8bc6\uff0c\u4f46\u5b83\u80fd\u591f\u5b9e\u73b0\u975e\u5e38\u7075\u6d3b\u548c\u5f3a\u5927\u7684\u6570\u636e\u5904\u7406\u529f\u80fd\u3002<\/p>\n<\/p>\n<p><h3>VBA\u66ff\u6362\u64cd\u4f5c\u793a\u4f8b<\/h3>\n<\/p>\n<p><p>\u4f8b\u5982\uff0c\u4ee5\u4e0b\u662f\u4e00\u4e2a\u7b80\u5355\u7684VBA\u811a\u672c\uff0c\u7528\u4e8e\u66ff\u6362\u5de5\u4f5c\u7c3f\u4e2d\u6240\u6709\u5de5\u4f5c\u8868\u7684\u7279\u5b9a\u6570\u636e\u3002\u8fd9\u6bb5\u4ee3\u7801\u7b80\u6d01\u800c\u9ad8\u6548\uff0c\u901a\u8fc7\u5faa\u73af\u904d\u5386\u6240\u6709\u5de5\u4f5c\u8868\u6765\u5b9e\u73b0\u5168\u9762\u7684\u66ff\u6362\u64cd\u4f5c\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-vba\">Sub ReplaceData()<\/p>\n<p>    Dim ws As Worksheet<\/p>\n<p>    For Each ws In ThisWorkbook.Worksheets<\/p>\n<p>        ws.Cells.Replace What:=&quot;old_text&quot;, Replacement:=&quot;new_text&quot;, LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False<\/p>\n<p>    Next ws<\/p>\n<p>End Sub<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h2>\u56db\u3001\u603b\u7ed3\u548c\u6700\u4f73\u5b9e\u8df5<\/h2>\n<\/p>\n<p><p>Excel\u8868\u683c\u6570\u636e\u66ff\u6362\u529f\u80fd\u5f3a\u5927\u800c\u7075\u6d3b\uff0c\u53ef\u4ee5\u5927\u5e45\u63d0\u9ad8\u6570\u636e\u5904\u7406\u7684\u6548\u7387\u3002\u65e0\u8bba\u662f\u4f7f\u7528\u67e5\u627e\u548c\u66ff\u6362\u529f\u80fd\u3001\u5229\u7528\u516c\u5f0f\uff0c\u8fd8\u662f\u901a\u8fc7VBA\u4ee3\u7801\uff0c\u90fd\u80fd\u6709\u6548\u5730\u89e3\u51b3\u6570\u636e\u66ff\u6362\u9700\u6c42\u3002\u4e3a\u4e86\u6700\u5927\u5316\u5de5\u4f5c\u6548\u7387\uff0c\u5efa\u8bae\u6839\u636e\u66ff\u6362\u4efb\u52a1\u7684\u590d\u6742\u7a0b\u5ea6\u548c\u9891\u7e41\u5ea6\u6765\u9009\u62e9\u5408\u9002\u7684\u65b9\u6cd5\u3002<\/p>\n<\/p>\n<p><p><strong>\u67e5\u627e\u548c\u66ff\u6362\u529f\u80fd<\/strong>\u9002\u5408\u6267\u884c\u7b80\u5355\u7684\u66ff\u6362\u4efb\u52a1\uff1b<strong>\u5229\u7528\u516c\u5f0f\u8fdb\u884c\u66ff\u6362<\/strong>\u5219\u66f4\u9002\u5408\u9700\u8981\u6309\u7279\u5b9a\u89c4\u5219\u6539\u53d8\u6570\u636e\u7684\u573a\u666f\uff1b\u800c<strong>VBA\u7f16\u7a0b<\/strong>\u5219\u9002\u7528\u4e8e\u590d\u6742\u7684\u81ea\u52a8\u5316\u6570\u636e\u5904\u7406\u4efb\u52a1\u3002\u540c\u65f6\uff0c\u638c\u63e1\u8fd9\u4e9b\u65b9\u6cd5\u7684\u9ad8\u7ea7\u6280\u5de7\u548c\u529f\u80fd\u80fd\u591f\u8ba9\u4f60\u5728\u5904\u7406\u590d\u6742\u6570\u636e\u65f6\u5982\u9c7c\u5f97\u6c34\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p><strong>Q1\uff1a\u5982\u4f55\u5728Microsoft Excel\u4e2d\u66ff\u6362\u8868\u683c\u6570\u636e\uff1f<\/strong><\/p>\n<p>\u5728Excel\u4e2d\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528\u201c\u67e5\u627e\u548c\u66ff\u6362\u201d\u529f\u80fd\u6765\u66ff\u6362\u8868\u683c\u6570\u636e\u3002\u9996\u5148\uff0c\u9009\u4e2d\u4f60\u60f3\u8981\u66ff\u6362\u6570\u636e\u7684\u8303\u56f4\uff0c\u7136\u540e\u6309\u4e0b\u201cCtrl + H\u201d\u952e\uff0c\u6216\u8005\u5728\u201c\u5f00\u59cb\u201d\u9009\u9879\u5361\u7684\u7f16\u8f91\u533a\u57df\u70b9\u51fb\u201c\u67e5\u627e\u548c\u9009\u62e9\u201d\u6309\u94ae\uff0c\u9009\u62e9\u201c\u66ff\u6362\u201d\u9009\u9879\u3002\u5728\u5f39\u51fa\u7684\u5bf9\u8bdd\u6846\u4e2d\uff0c\u8f93\u5165\u4f60\u8981\u67e5\u627e\u7684\u5185\u5bb9\u548c\u60f3\u8981\u66ff\u6362\u7684\u65b0\u5185\u5bb9\uff0c\u7136\u540e\u70b9\u51fb\u201c\u66ff\u6362\u5168\u90e8\u201d\u6309\u94ae\u5373\u53ef\u3002<\/p>\n<p><strong>Q2\uff1a\u5982\u4f55\u6279\u91cf\u66ff\u6362Excel\u8868\u683c\u4e2d\u7684\u6570\u636e\uff1f<\/strong><\/p>\n<p>\u5982\u679c\u4f60\u9700\u8981\u6279\u91cf\u66ff\u6362Excel\u8868\u683c\u4e2d\u7684\u6570\u636e\uff0c\u53ef\u4ee5\u4f7f\u7528\u201c\u67e5\u627e\u548c\u66ff\u6362\u201d\u529f\u80fd\u7684\u9ad8\u7ea7\u9009\u9879\u3002\u5728\u201c\u67e5\u627e\u548c\u66ff\u6362\u201d\u5bf9\u8bdd\u6846\u4e2d\uff0c\u70b9\u51fb\u201c\u9009\u9879\u201d\u6309\u94ae\uff0c\u7136\u540e\u52fe\u9009\u201c\u9009\u62e9\u533a\u57df\u201d\u9009\u9879\u3002\u63a5\u4e0b\u6765\uff0c\u9009\u62e9\u4f60\u60f3\u8981\u66ff\u6362\u6570\u636e\u7684\u8303\u56f4\uff0c\u7136\u540e\u518d\u6b21\u70b9\u51fb\u201c\u66ff\u6362\u5168\u90e8\u201d\u6309\u94ae\u5373\u53ef\u540c\u65f6\u66ff\u6362\u6240\u6709\u5339\u914d\u9879\u3002<\/p>\n<p><strong>Q3\uff1a\u5982\u4f55\u4f7f\u7528Excel\u516c\u5f0f\u66ff\u6362\u8868\u683c\u6570\u636e\uff1f<\/strong><\/p>\n<p>\u9664\u4e86\u4f7f\u7528\u201c\u67e5\u627e\u548c\u66ff\u6362\u201d\u529f\u80fd\uff0c\u4f60\u8fd8\u53ef\u4ee5\u4f7f\u7528Excel\u516c\u5f0f\u6765\u66ff\u6362\u8868\u683c\u6570\u636e\u3002\u9996\u5148\uff0c\u5728\u4e00\u4e2a\u7a7a\u767d\u7684\u5355\u5143\u683c\u4e2d\u8f93\u5165\u516c\u5f0f\uff0c\u4f7f\u7528\u51fd\u6570\u5982\u201cSUBSTITUTE\u201d\u3001\u201cREPLACE\u201d\u7b49\u6765\u5b9e\u73b0\u66ff\u6362\u529f\u80fd\u3002\u4f8b\u5982\uff0c\u5982\u679c\u4f60\u60f3\u5c06A\u5217\u7684\u201capple\u201d\u66ff\u6362\u4e3a\u201cbanana\u201d\uff0c\u53ef\u4ee5\u5728B\u5217\u7684\u7b2c\u4e00\u4e2a\u5355\u5143\u683c\u4e2d\u8f93\u5165<code>=SUBSTITUTE(A1, &quot;apple&quot;, &quot;banana&quot;)<\/code>\uff0c\u7136\u540e\u5c06\u516c\u5f0f\u62d6\u62fd\u5230\u5176\u4ed6\u5355\u5143\u683c\u4e2d\uff0c\u5373\u53ef\u6279\u91cf\u66ff\u6362\u6570\u636e\u3002\u8fd9\u79cd\u65b9\u6cd5\u7279\u522b\u9002\u7528\u4e8e\u9700\u8981\u6839\u636e\u7279\u5b9a\u6761\u4ef6\u66ff\u6362\u6570\u636e\u7684\u60c5\u51b5\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"Excel\u8868\u683c\u6570\u636e\u66ff\u6362\u53ef\u4ee5\u901a\u8fc7\u591a\u79cd\u65b9\u6cd5\u5b9e\u73b0\uff0c\u4e3b\u8981\u5305\u62ec\u4f7f\u7528\u67e5\u627e\u548c\u66ff\u6362\u529f\u80fd\u3001\u5229\u7528\u516c\u5f0f\u8fdb\u884c\u66ff\u6362\u3001\u4ee5\u53ca\u8fd0\u7528VBA\u4ee3\u7801\u6765 [&hellip;]","protected":false},"author":3,"featured_media":138420,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[37],"tags":[],"acf":[],"_links":{"self":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/138414"}],"collection":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/comments?post=138414"}],"version-history":[{"count":0,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/138414\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/138420"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=138414"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=138414"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=138414"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}