
The Excel REPT function repeats a text string a specified number of times. For example, =REPT("*",5) returns "*****". The result is always one text string.
REPT is simple, but it has several useful worksheet patterns. It can build in-cell bars, create star ratings, and pad short values with leading zeros when combined with LEN.
Returns the same text over and over based on the count you provide.
Returns repeated text. If the repeat count is 0, the result is an empty string.
=REPT(text, number_times)
text is the character or string to repeat. number_times is how many times it should be repeated. Both arguments are required.
REPT is usually paired with other functions rather than compared directly to them. LEN helps when you need fixed-width padding, and simple math can scale a bar or rating before REPT displays it.
| Pattern | Example | Use When |
|---|---|---|
| Simple repeat | =REPT("*",5) |
You need the same symbol repeated a fixed number of times |
| Bar display | =REPT("|",A1) |
You want a quick visual bar |
| Zero padding | =REPT("0",6-LEN(A1))&A1 |
You need a fixed-width ID |
| Rating display | =REPT("★",A1) |
You want a visual rating inside a cell |
One common use of REPT is building simple visuals without charts. Repeating a symbol such as | or ★ can turn a number into a bar or a rating that is easy to scan in a table.
Another common use is padding values to a fixed length. If an ID must always be 6 characters long, =REPT("0",6-LEN(A1))&A1 adds only the zeros that are missing.
This is the direct use of REPT. Excel repeats the text exactly the number of times you request and joins the result into one string.
=REPT("*", 5) // "*****"
=REPT("-", 20) // separator line
=REPT("ha", 3) // "hahaha"
In cell F1, use REPT to repeat the asterisk "*" five times. Expected result: "*****".
REPT can turn a value into a quick visual. The more times the symbol is repeated, the longer the bar becomes. This is a lightweight alternative to inserting a full chart.
=REPT("|", 8) // "||||||||"
=REPT("|", A1) // bar length depends on A1
=REPT("|", A1/10) // shorter scaled bar
In cell F2, use REPT to create a bar of 8 pipe characters "|". Expected result: "||||||||".
This is one of the most practical REPT patterns. LEN measures the current length, REPT creates the missing zeros, and &A1 joins the zeros with the original value.
=REPT("0", 6-LEN(A1))&A1
// A1="55" -> "000055"
// A1="12345" -> "012345"
In cell F3, pad the value in A1 ("55") with zeros so the total length is 6. Formula: =REPT("0",6-LEN(A1))&A1.
REPT can also turn a rating number into a visual score. This works well in reports where a quick visual cue is more useful than the raw number alone.
=REPT("★", 5) // "★★★★★"
=REPT("★", A1) // stars based on A1
=REPT("★", A1)&REPT("☆",5-A1)
In cell F4, use REPT to display 5 star characters. Formula: =REPT("★",5).
REPT cannot return more than 32,767 characters. If the repeated result would be longer than that, Excel returns #VALUE!. In normal worksheet use, that limit rarely causes problems, but it is worth knowing.
REPT repeats text a chosen number of times.=REPT(text, number_times).Tell your friends about this post