REPT function

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)

Argument Description Remarks
text The text that you want to repeat.
  • None.
number_times A positive number specifying the number of times to repeat text.
  • If number_times is 0 (zero), REPT returns "" (empty text).
  • If this argument contains a decimal value, this function ignores the numbers to the right side of the decimal point.

General remarks

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

 Tip   You can use this function to create a simple histogram on your sheet.

Example

To make the following example easier to understand, you can copy the data to a blank sheet and then enter the function underneath the data. Do not select the row or column headings (1, 2, 3... A, B, C...) when you copy the sample data to a blank sheet.

Formula Description (Result)
=REPT("*-",3) Displays the string 3 times (*-*-*-)
=REPT("-",10) Displays a dash 10 times (----------)

See also

List of all functions (by category)

 
 
Applies to:
Excel for Mac 2011