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.

本文將說明公式語法及 REPT 的使用方式  函數。

描述

依指定的次數重複文字。 使用 REPT 函數可在儲存格中填入重複出現的文字字串。

語法

REPT(text, number_times)

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

  • Text    必要。 這是要重複的文字。

  • Number_times    必要。 這是指定文字重複次數的正數。

註解

  • 如果 number_times 為 0 (零),則 REPT 會傳回 "" (空白文字)。

  • 如果 number_times 不是整數,則會取至整數。

  • REPT 函數的結果不能長於 32,767 個字元,否則 REPT 會傳回 #VALUE!。

範例

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

公式

描述

結果

=REPT("*-", 3)

會顯示星號和虛線 (*-) 3 次。

*-*-*-

=REPT("-",10)

會顯示虛線 (-) 10 次。

----------

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!

×