Thursday, January 16, 2020

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.

----------

Expand your Office skills
Explore training
Got It
Get instant Excel help
Connect to an expert now
Subject to Got It terms and conditions