Sign in with Microsoft
Sign in or create an account.
Hello,
Select a different account.
You have multiple accounts
Choose the account you want to sign in with.

本文將說明 Microsoft Excel 中 SUBSTITUTE 函數的公式語法及使用方式。

描述

將文字字串中的 old_text 部分以 new_text 取代。 要取代文字字串中的特定字串時,可以使用 SUBSTITUTE;若要取代文字字串中特定位置上的任何字串,請使用 REPLACE。

語法

SUBSTITUTE(text, old_text, new_text, [instance_num])

SUBSTITUTE 函數語法具有下列引數:

  • Text    必要。 這是包含要以字元取代文字的文字或參照。

  • Old_text    必要。 這是要取代的文字。

  • New_text    必要。 這是要用來取代 old_text 的文字。

  • Instance_num    選用。 指定要將第幾個 old_text 取代為 new_text。 如果您指定 instance_num,則只會取代該 old_text。 否則,text 中的每一個 old_text 都會變更為 new_text。

範例

請在下列表格中複製範例資料,再將之貼到新 Excel 活頁簿中的儲存格 A1。 若要讓公式顯示結果,請選取公式,按 F2,然後再按 Enter。 如有需要,您可以調整欄寬來查看所有資料。

資料

銷售資料

<

2008 年第 1 季

<

2011 年第 1 季

<

公式

描述 (結果)

結果

=SUBSTITUTE(A2, "銷售", "成本")

銷售的代替成本 (成本資料)

成本資料

=SUBSTITUTE(A3, "1", "2", 1)

用第一個執行個體 "1" 取代 "2" (2008 年第 2 季)

2008 年第 2 季

=SUBSTITUTE(A4, "1", "2", 3)

用第三個執行個體 "1" 取代 "2" (2012 年第 1 季)

2012 年第 1 季

另請參閱

REPLACE 與 REPLACEB 函數

TRIM 函數

Need more help?

Want more options?

探索訂閱權益、瀏覽訓練課程、瞭解如何保護您的裝置等等。

社群可協助您詢問並回答問題、提供意見反應,以及聆聽來自具有豐富知識的專家意見。

Was this information helpful?

How satisfied are you with the translation quality?
What affected your experience?
By pressing submit, your feedback will be used to improve Microsoft products and services. Your IT admin will be able to collect this data. Privacy Statement.

Thank you for your feedback!

×