Description
Use this function to repeat text a specified number of times. Supported in Chains.
REPT is useful for creating repeating patterns, filling cells with a specific character, or generating placeholder text.
Syntax
REPT(text, number_times)
Inputs
This function accepts the following arguments:
| Name | Required | Description | Valid input |
|---|---|---|---|
text |
Yes | The text you want to repeat. | A number, a text string, a cell reference, or a formula which results in any of these. |
number_times |
Yes | The number of times to repeat the text. | A positive integer, a reference to a cell containing a positive integer, or a formula which results in either of these. If this is not an integer, it is truncated. |
Example
Sample data
| A | B |
|---|---|
| Text | Number |
| ABC | 3 |
| * | 5 |
| 123 | 2 |
| Hello | 4 |
Sample formulas
| Formula | Description | Result |
|---|---|---|
=REPT(A2, B2) |
Repeats "ABC" 3 times. | ABCABCABC |
=REPT(A3, B3) |
Repeats "*" 5 times. | ***** |
=REPT(A4, B4) |
Repeats "123" 2 times. | 123123 |
=REPT(A5, B5) |
Repeats "Hello " 4 times. | Hello Hello Hello Hello |
=REPT("-", 10) |
Creates a line of 10 dashes. | ---------- |
Notes
- If
number_timesis 0, REPT returns an empty string. - If
number_timesis negative, REPT returns a #VALUE! error. - The resulting text string can be up to 32,767 characters long. If the result is longer, REPT returns a #VALUE! error.
- Non-integer values for number_times are truncated to integers.
Tips
- Use REPT to create visual separators in your spreadsheet, like lines of dashes or stars.
- Combine REPT with other text functions such as CONCATENATE or '
&' to create more complex text patterns. - When working with large numbers of repetitions, be mindful of the 32,767 character limit.
Related functions
CHAR
CODE
CONCATENATE
CONCATENATEIF
FIND
LEFT
LEN
LOWER
MID
PROPER
REPT
RIGHT
SEARCH
SUBSTITUTE
TEXT
TEXTJOIN
TRIM
UNICHAR
UNICODE
UPPER