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 | ||
|---|---|---|---|
| 1 | Text | Number | |
| 2 | ABC | 3 | |
| 3 | * | 5 | |
| 4 | 123 | 2 | |
| 5 | Hello | 4 |
Sample formulas
| Use case | Formula | Explanation and Result |
|---|---|---|
| Repeat a short piece of text a set number of times. | =REPT(A2, B2) |
Repeats "ABC" 3 times back-to-back. Result: ABCABCABC |
| Create a visual separator by repeating a single character. | =REPT(A3, B3) |
Repeats "*" 5 times to form a simple divider. Result: ***** |
| Repeat a number stored as text a set number of times. | =REPT(A4, B4) |
Repeats "123" 2 times back-to-back. Result: 123123 |
| Repeat a word with a trailing space to keep each repetition visually separated. | =REPT(A5, B5) |
Repeats "Hello " (including its trailing space) 4 times, so each "Hello" reads as a separate word. Result: Hello Hello Hello Hello |
| Build a line of dashes using a character typed directly into the formula. | =REPT("-", 10) |
Repeats "-" 10 times to create a divider line. Result: ---------- |
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.