REPT function

This article describes the formula syntax and usage of the REPT  function in Microsoft Excel.

Description

Repeats text a given number of times. Use REPT to fill a cell with a number of instances of a text string.

Syntax

REPT(text, number_times)

The REPT function syntax has the following arguments:

  • Text    Required. The text you want to repeat.

  • Number_times    Required. A positive number specifying the number of times to repeat text.

Remarks

  • If number_times is 0 (zero), REPT returns "" (empty text).

  • If number_times is not an integer, it is truncated.

  • The result of the REPT function cannot be longer than 32,767 characters, or REPT returns #VALUE!.

Example

Copy the example data in the following table, and paste it in cell A1 of a new Excel worksheet. For formulas to show results, select them, press F2, and then press Enter. If you need to, you can adjust the column widths to see all the data.

Formula

Description

Result

=REPT("*-", 3)

Displays an asterisk and a dash (*-) 3 times.

*-*-*-

=REPT("-",10)

Displays a dash (-) 10 times.

----------

Applies To: Excel 2010, Excel Starter, Excel 2013, Excel Online, Excel 2016 for Mac, Excel for Mac 2011, Excel 2007



Was this information helpful?

Yes No

How can we improve it?

255 characters remaining

To protect your privacy, please do not include contact information in your feedback. Review our privacy policy.

Thank you for your feedback!

Support resources

Change language