{"id":138422,"date":"2024-04-28T13:11:25","date_gmt":"2024-04-28T05:11:25","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/138422.html"},"modified":"2024-04-28T13:11:27","modified_gmt":"2024-04-28T05:11:27","slug":"excel%e8%a1%a8%e6%a0%bc%e6%80%8e%e4%b9%88%e6%9b%bf%e6%8d%a2%e6%95%b0%e6%8d%ae","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/138422.html","title":{"rendered":"excel\u8868\u683c\u600e\u4e48\u66ff\u6362\u6570\u636e"},"content":{"rendered":"<p style=\"text-align:center\"><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/24134054\/78ed8348-3627-484f-a42b-106405db5b78.webp\" alt=\"excel\u8868\u683c\u600e\u4e48\u66ff\u6362\u6570\u636e\" \/><\/p>\n<p><p>\u5728Excel\u8868\u683c\u4e2d\u66ff\u6362\u6570\u636e\u662f\u4e00\u4e2a\u5e38\u7528\u4e14\u91cd\u8981\u7684\u64cd\u4f5c\uff0c\u53ef\u4ee5<strong>\u5feb\u901f\u5b8c\u6210\u6570\u636e\u7684\u66f4\u65b0\u548c\u4fee\u6b63<\/strong>\u3002\u4e3b\u8981\u65b9\u6cd5\u6709\u4f7f\u7528\u201c\u67e5\u627e\u548c\u66ff\u6362\u201d\u529f\u80fd\u3001\u4f7f\u7528\u516c\u5f0f\u3001\u4ee5\u53ca\u5229\u7528VBA\u811a\u672c\u3002<strong>\u5176\u4e2d\uff0c\u4f7f\u7528\u201c\u67e5\u627e\u548c\u66ff\u6362\u201d\u529f\u80fd\u662f\u6700\u76f4\u63a5\u548c\u666e\u904d\u7684\u65b9\u6cd5<\/strong>\uff0c\u5b83\u5141\u8bb8\u7528\u6237\u9488\u5bf9\u6574\u4e2a\u5de5\u4f5c\u7c3f\u6216\u7279\u5b9a\u8303\u56f4\u5185\u7684\u6570\u636e\u8fdb\u884c\u67e5\u627e\uff0c\u5e76\u66ff\u6362\u6210\u7528\u6237\u6307\u5b9a\u7684\u6570\u636e\uff0c\u6781\u5927\u63d0\u9ad8\u4e86\u6570\u636e\u5904\u7406\u7684\u6548\u7387\u3002<\/p>\n<\/p>\n<p><p>\u63a5\u4e0b\u6765\uff0c\u6211\u4eec\u5c06\u8be6\u7ec6\u63a2\u8ba8\u5982\u4f55\u5229\u7528\u8fd9\u4e9b\u65b9\u6cd5\u6709\u6548\u5730\u5728Excel\u4e2d\u66ff\u6362\u6570\u636e\u3002<\/p>\n<\/p>\n<p><h2>\u4e00\u3001\u4f7f\u7528\u201c\u67e5\u627e\u548c\u66ff\u6362\u201d\u529f\u80fd<\/h2>\n<\/p>\n<p><p>Excel\u7684\u201c\u67e5\u627e\u548c\u66ff\u6362\u201d\u529f\u80fd\u662f\u5904\u7406\u6570\u636e\u66ff\u6362\u4efb\u52a1\u6700\u5feb\u6377\u7684\u65b9\u6cd5\u4e4b\u4e00\u3002\u64cd\u4f5c\u7b80\u5355\uff0c\u5373\u4f7f\u662fExcel\u65b0\u624b\u4e5f\u53ef\u4ee5\u8f7b\u677e\u638c\u63e1\u3002<\/p>\n<\/p>\n<p><h3>\u6b65\u9aa4\u4ecb\u7ecd<\/h3>\n<\/p>\n<ol>\n<li>\u6253\u5f00Excel\u8868\u683c\uff0c\u9009\u4e2d\u9700\u8981\u64cd\u4f5c\u7684\u6570\u636e\u8303\u56f4\u6216\u6309<code>Ctrl + A<\/code>\u9009\u62e9\u6574\u4e2a\u5de5\u4f5c\u8868\u3002<\/li>\n<li>\u70b9\u51fb\u201c\u5f00\u59cb\u201d\u6807\u7b7e\u4e0b\u7684\u201c\u67e5\u627e\u548c\u9009\u62e9\u201d\u6309\u94ae\uff0c\u9009\u62e9\u201c\u66ff\u6362\u201d\uff0c\u6216\u76f4\u63a5\u6309<code>Ctrl + H<\/code>\u5feb\u6377\u952e\u6253\u5f00\u201c\u67e5\u627e\u548c\u66ff\u6362\u201d\u5bf9\u8bdd\u6846\u3002<\/li>\n<li>\u5728\u201c\u67e5\u627e\u5185\u5bb9\u201d\u6846\u4e2d\u8f93\u5165\u8981\u67e5\u627e\u7684\u6570\u636e\uff0c\u5728\u201c\u66ff\u6362\u4e3a\u201d\u6846\u4e2d\u8f93\u5165\u66ff\u6362\u540e\u7684\u6570\u636e\u3002<\/li>\n<li>\u70b9\u51fb\u201c\u67e5\u627e\u4e0b\u4e00\u4e2a\u201d\u6765\u5b9a\u4f4d\u7b2c\u4e00\u4e2a\u5339\u914d\u9879\uff0c\u6216\u70b9\u51fb\u201c\u5168\u90e8\u66ff\u6362\u201d\u6765\u66ff\u6362\u6240\u6709\u5339\u914d\u9879\u3002<\/li>\n<li>\u8fdb\u884c\u66ff\u6362\u64cd\u4f5c\u540e\uff0c\u786e\u8ba4\u6240\u6709\u6570\u636e\u5df2\u6b63\u786e\u66ff\u6362\uff0c\u70b9\u51fb\u201c\u5173\u95ed\u201d\u7ec8\u6b62\u64cd\u4f5c\u3002<\/li>\n<\/ol>\n<p><h3>\u6df1\u5165\u7406\u89e3<\/h3>\n<\/p>\n<p><p>\u5f53\u5904\u7406\u5927\u91cf\u6570\u636e\u65f6\uff0c\u201c\u67e5\u627e\u548c\u66ff\u6362\u201d\u7684\u201c\u9009\u9879\u201d\u529f\u80fd\u53ef\u4ee5\u8fdb\u4e00\u6b65\u7ec6\u5316\u67e5\u627e\u548c\u66ff\u6362\u6761\u4ef6\uff0c\u5305\u62ec\u5339\u914d\u6574\u4e2a\u5355\u5143\u683c\u5185\u5bb9\u3001\u533a\u5206\u5927\u5c0f\u5199\u7b49\uff0c\u4f7f\u5f97\u6570\u636e\u66ff\u6362\u66f4\u52a0\u7cbe\u786e\u3002<\/p>\n<\/p>\n<p><h2>\u4e8c\u3001\u8fd0\u7528\u516c\u5f0f\u8fdb\u884c\u6570\u636e\u66ff\u6362<\/h2>\n<\/p>\n<p><p>\u53e6\u4e00\u79cd\u7075\u6d3b\u7684\u66ff\u6362\u6570\u636e\u65b9\u6cd5\u662f\u5229\u7528Excel\u5185\u7f6e\u7684\u5404\u79cd\u516c\u5f0f\u3002\u4f8b\u5982\uff0c<code>SUBSTITUTE<\/code>\u3001<code>REPLACE<\/code>\u7b49\u51fd\u6570\u53ef\u4ee5\u5b9a\u5236\u66f4\u590d\u6742\u7684\u6570\u636e\u66ff\u6362\u903b\u8f91\u3002<\/p>\n<\/p>\n<p><h3>SUBSTITUTE\u51fd\u6570\u4f7f\u7528<\/h3>\n<\/p>\n<ol>\n<li><code>SUBSTITUTE<\/code>\u51fd\u6570\u53ef\u4ee5\u66ff\u6362\u6587\u672c\u4e2d\u7684\u67d0\u4e2a\u90e8\u5206\u3002\u5176\u8bed\u6cd5\u4e3a<code>SUBSTITUTE(text, old_text, new_text, [instance_num])<\/code>\uff0c\u5176\u4e2d<code>text<\/code>\u662f\u9700\u8981\u5904\u7406\u7684\u6587\u672c\uff0c<code>old_text<\/code>\u662f\u6587\u672c\u4e2d\u8981\u66ff\u6362\u7684\u5b57\u7b26\uff0c<code>new_text<\/code>\u662f\u66ff\u6362\u540e\u7684\u5b57\u7b26\uff0c<code>instance_num<\/code>\u662f\u53ef\u9009\u53c2\u6570\uff0c\u8868\u793a\u8981\u66ff\u6362\u7684\u662f\u7b2c\u51e0\u4e2a<code>old_text<\/code>\u3002<\/li>\n<li>\u4f8b\u5982\uff0c\u5982\u679c\u60f3\u5c06\u5355\u5143\u683cA1\u4e2d\u7684\u6240\u6709&quot;apple&quot;\u66ff\u6362\u6210&quot;orange&quot;\uff0c\u516c\u5f0f\u4e3a<code>=SUBSTITUTE(A1, &quot;apple&quot;, &quot;orange&quot;)<\/code>\u3002<\/li>\n<\/ol>\n<p><h3>REPLACE\u51fd\u6570\u4f7f\u7528<\/h3>\n<\/p>\n<ol>\n<li><code>REPLACE<\/code>\u51fd\u6570\u6839\u636e\u4f4d\u7f6e\u66ff\u6362\u6587\u672c\u3002\u5176\u8bed\u6cd5\u4e3a<code>REPLACE(old_text, start_num, num_chars, new_text)<\/code>\uff0c<code>old_text<\/code>\u662f\u539f\u59cb\u6587\u672c\uff0c<code>start_num<\/code>\u662f\u5f00\u59cb\u66ff\u6362\u7684\u4f4d\u7f6e\uff0c<code>num_chars<\/code>\u662f\u8981\u66ff\u6362\u7684\u5b57\u7b26\u6570\u91cf\uff0c<code>new_text<\/code>\u662f\u66ff\u6362\u4e4b\u540e\u7684\u6587\u672c\u3002<\/li>\n<li>\u4e3e\u4e2a\u4f8b\u5b50\uff0c\u60f3\u8981\u5c06A1\u5355\u5143\u683c\u4e2d\u4ece\u7b2c3\u4e2a\u5b57\u7b26\u5f00\u59cb\u76842\u4e2a\u5b57\u7b26\u66ff\u6362\u4e3a&quot;xx&quot;\uff0c\u5219\u516c\u5f0f\u4e3a<code>=REPLACE(A1, 3, 2, &quot;xx&quot;)<\/code>\u3002<\/li>\n<\/ol>\n<p><p>\u8fd9\u4e9b\u51fd\u6570\u4e3a\u6570\u636e\u66ff\u6362\u63d0\u4f9b\u4e86\u5f3a\u5927\u7075\u6d3b\u6027\uff0c\u5c24\u5176\u9002\u5408\u8fdb\u884c\u6279\u91cf\u4e14\u6761\u4ef6\u590d\u6742\u7684\u6570\u636e\u66ff\u6362\u4efb\u52a1\u3002<\/p>\n<\/p>\n<p><h2>\u4e09\u3001\u4f7f\u7528VBA\u811a\u672c\u5b9e\u73b0\u9ad8\u7ea7\u66ff\u6362<\/h2>\n<\/p>\n<p><p>\u5bf9\u4e8e\u4e00\u4e9b\u590d\u6742\u7684\u6570\u636e\u66ff\u6362\u9700\u6c42\uff0c\u5229\u7528Excel\u7684VBA\uff08Visual Basic for Applications\uff09\u7f16\u7a0b\u53ef\u4ee5\u5b9e\u73b0\u9ad8\u5ea6\u5b9a\u5236\u5316\u7684\u6570\u636e\u5904\u7406\u3002<\/p>\n<\/p>\n<p><h3>VBA\u66ff\u6362\u65b9\u6cd5\u793a\u4f8b<\/h3>\n<\/p>\n<ol>\n<li>\u6309<code>Alt + F11<\/code>\u6253\u5f00VBA\u7f16\u8f91\u5668\uff0c\u70b9\u51fb\u201c\u63d2\u5165\u201d&gt;\u201c\u6a21\u5757\u201d\uff0c\u5728\u6a21\u5757\u4e2d\u8f93\u5165\u4ee5\u4e0b\u793a\u4f8b\u4ee3\u7801\uff1a<\/li>\n<\/ol>\n<p><pre><code class=\"language-vb\">Sub ReplaceData()<\/p>\n<p>    Dim ws As Worksheet<\/p>\n<p>    For Each ws In ThisWorkbook.Sheets<\/p>\n<p>        ws.Cells.Replace What:=&quot;oldValue&quot;, Replacement:=&quot;newValue&quot;, LookAt:=xlPart, SearchOrder:=xlByRows<\/p>\n<p>    Next ws<\/p>\n<p>End Sub<\/p>\n<p><\/code><\/pre>\n<\/p>\n<ol start=\"2\">\n<li>\u5c06\u4e0a\u8ff0\u4ee3\u7801\u4e2d\u7684&quot;oldValue&quot;\u66f4\u6539\u4e3a\u9700\u8981\u67e5\u627e\u7684\u5185\u5bb9\uff0c&quot;newValue&quot;\u66f4\u6539\u4e3a\u66ff\u6362\u540e\u7684\u5185\u5bb9\u3002<\/li>\n<li>\u8fd0\u884c\u8be5\u5b8f\uff0c\u5b83\u4f1a\u904d\u5386\u5de5\u4f5c\u7c3f\u4e2d\u6240\u6709\u5de5\u4f5c\u8868\uff0c\u66ff\u6362\u6bcf\u4e2a\u8868\u4e2d\u7684\u6307\u5b9a\u6570\u636e\u3002<\/li>\n<\/ol>\n<p><h3>VBA\u9ad8\u7ea7\u6280\u5de7<\/h3>\n<\/p>\n<p><p>\u901a\u8fc7\u7f16\u5199\u66f4\u590d\u6742\u7684VBA\u811a\u672c\uff0c\u53ef\u4ee5\u5b9e\u73b0\u5982\u6b63\u5219\u8868\u8fbe\u5f0f\u67e5\u627e\u3001\u7279\u5b9a\u6761\u4ef6\u4e0b\u7684\u6570\u636e\u66ff\u6362\u7b49\u9ad8\u7ea7\u529f\u80fd\uff0c\u4e3a\u5904\u7406\u590d\u6742\u7684\u6570\u636e\u66ff\u6362\u9700\u6c42\u63d0\u4f9b\u4e86\u53ef\u80fd\u6027\u3002<\/p>\n<\/p>\n<p><h2>\u56db\u3001\u7ed3\u8bba<\/h2>\n<\/p>\n<p><p>\u4e0d\u540c\u7684\u6570\u636e\u66ff\u6362\u9700\u6c42\u53ef\u4ee5\u901a\u8fc7\u4e0d\u540c\u7684\u65b9\u6cd5\u6765\u5b9e\u73b0\u3002\u5bf9\u4e8e\u7b80\u5355\u7684\u66ff\u6362\u4efb\u52a1\uff0c\u201c\u67e5\u627e\u548c\u66ff\u6362\u201d\u662f\u6700\u76f4\u63a5\u6709\u6548\u7684\u65b9\u6cd5\u3002\u800c\u516c\u5f0f\u63d0\u4f9b\u4e86\u66f4\u591a\u7075\u6d3b\u6027\uff0c\u9002\u5408\u5904\u7406\u4e00\u4e9b\u7279\u5b9a\u7684\u66ff\u6362\u6761\u4ef6\u3002\u5bf9\u4e8e\u66f4\u590d\u6742\u7684\u9700\u6c42\uff0cVBA\u811a\u672c\u63d0\u4f9b\u4e86\u51e0\u4e4e\u65e0\u9650\u7684\u53ef\u80fd\u6027\u3002\u638c\u63e1\u8fd9\u4e9b\u65b9\u6cd5\uff0c\u5c06\u5927\u5927\u63d0\u9ad8\u5728Excel\u4e2d\u5904\u7406\u6570\u636e\u7684\u6548\u7387\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p><strong>1. \u5982\u4f55\u5728Excel\u4e2d\u66ff\u6362\u5355\u4e2a\u6570\u503c\u6216\u6587\u672c\uff1f<\/strong><\/p>\n<p>\u5728Excel\u4e2d\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528&quot;\u67e5\u627e\u548c\u66ff\u6362&quot;\u529f\u80fd\u6765\u66ff\u6362\u5355\u4e2a\u6570\u503c\u6216\u6587\u672c\u3002\u9996\u5148\u9009\u4e2d\u8981\u66ff\u6362\u7684\u6570\u636e\u6240\u5728\u7684\u5355\u5143\u683c\u8303\u56f4\uff0c\u7136\u540e\u6309\u4e0b\u952e\u76d8\u4e0a\u7684Ctrl + F\u5feb\u6377\u952e\uff0c\u5728\u5f39\u51fa\u7684\u7a97\u53e3\u4e2d\u8f93\u5165\u8981\u67e5\u627e\u7684\u5185\u5bb9\uff0c\u63a5\u7740\u5728&quot;\u66ff\u6362\u4e3a&quot;\u680f\u76ee\u4e2d\u8f93\u5165\u8981\u66ff\u6362\u7684\u65b0\u5185\u5bb9\uff0c\u6700\u540e\u70b9\u51fb&quot;\u66ff\u6362&quot;\u6309\u94ae\u5373\u53ef\u5b8c\u6210\u66ff\u6362\u64cd\u4f5c\u3002<\/p>\n<p><strong>2. \u5982\u4f55\u6279\u91cf\u66ff\u6362Excel\u4e2d\u7684\u6570\u636e\uff1f<\/strong><\/p>\n<p>\u82e5\u4f60\u9700\u8981\u6279\u91cf\u66ff\u6362Excel\u4e2d\u7684\u6570\u636e\uff0c\u53ef\u4ee5\u4f7f\u7528Excel\u4e2d\u7684&quot;\u67e5\u627e\u548c\u66ff\u6362&quot;\u529f\u80fd\u7684\u9ad8\u7ea7\u9009\u9879\u3002\u9009\u62e9\u8981\u66ff\u6362\u7684\u6570\u636e\u6240\u5728\u7684\u5355\u5143\u683c\u8303\u56f4\u540e\uff0c\u6309\u4e0bCtrl + F\u6253\u5f00&quot;\u67e5\u627e\u548c\u66ff\u6362&quot;\u7a97\u53e3\uff0c\u5728\u8981\u67e5\u627e\u7684\u5185\u5bb9\u680f\u76ee\u4e2d\u8f93\u5165\u8981\u66ff\u6362\u7684\u539f\u5185\u5bb9\uff0c\u63a5\u7740\u5728&quot;\u66ff\u6362\u4e3a&quot;\u680f\u76ee\u4e2d\u8f93\u5165\u8981\u66ff\u6362\u7684\u65b0\u5185\u5bb9\uff0c\u5728\u70b9\u51fb&quot;\u66ff\u6362\u6240\u6709&quot;\u6309\u94ae\u5373\u53ef\u5b8c\u6210\u6279\u91cf\u66ff\u6362\u64cd\u4f5c\u3002<\/p>\n<p><strong>3. \u5982\u4f55\u5728Excel\u4e2d\u8fdb\u884c\u66ff\u6362\u65f6\u4fdd\u7559\u539f\u6709\u683c\u5f0f\uff1f<\/strong><\/p>\n<p>\u5f53\u4f60\u5728\u66ff\u6362Excel\u4e2d\u7684\u6570\u636e\u65f6\uff0c\u5982\u679c\u60f3\u4fdd\u7559\u539f\u6709\u7684\u683c\u5f0f\uff0c\u53ef\u4ee5\u4f7f\u7528&quot;\u67e5\u627e\u548c\u66ff\u6362&quot;\u529f\u80fd&gt;\u9ad8\u7ea7\u9009\u9879\u4e2d\u7684&quot;\u683c\u5f0f&quot;\u9009\u9879\u3002\u5728&quot;\u67e5\u627e\u548c\u66ff\u6362&quot;\u7a97\u53e3\u4e2d\uff0c\u70b9\u51fb&quot;\u9009\u9879&quot;\u6309\u94ae\uff0c\u5728\u6253\u5f00\u7684\u7a97\u53e3\u4e2d\u9009\u62e9&quot;\u66ff\u6362\u5355\u5143\u683c\u683c\u5f0f&quot;\u590d\u9009\u6846\uff0c\u7136\u540e\u70b9\u51fb&quot;\u66ff\u6362&quot;\u6309\u94ae\uff0cExcel\u5c06\u4f1a\u540c\u65f6\u66ff\u6362\u6570\u503c\u6216\u6587\u672c\u5185\u5bb9\u53ca\u5176\u683c\u5f0f\u3002\u8fd9\u4e2a\u9009\u9879\u53ef\u4ee5\u5e2e\u52a9\u4f60\u5feb\u901f\u800c\u51c6\u786e\u5730\u8fdb\u884c\u6570\u636e\u66ff\u6362\uff0c\u540c\u65f6\u4fdd\u6301\u539f\u6709\u7684\u6570\u636e\u683c\u5f0f\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u5728Excel\u8868\u683c\u4e2d\u66ff\u6362\u6570\u636e\u662f\u4e00\u4e2a\u5e38\u7528\u4e14\u91cd\u8981\u7684\u64cd\u4f5c\uff0c\u53ef\u4ee5\u5feb\u901f\u5b8c\u6210\u6570\u636e\u7684\u66f4\u65b0\u548c\u4fee\u6b63\u3002\u4e3b\u8981\u65b9\u6cd5\u6709\u4f7f\u7528\u201c\u67e5\u627e\u548c\u66ff\u6362\u201d\u529f [&hellip;]","protected":false},"author":3,"featured_media":138423,"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\/138422"}],"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=138422"}],"version-history":[{"count":0,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/138422\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/138423"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=138422"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=138422"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=138422"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}