What is the REPT function?
=REPT(text, number_times)REPT joins copies of a text a given number of times. It is often used for star ratings (★★★) or simple bar charts inside a cell.
Play the steps on the strip above to see each copy shown in alternating colors.
Arguments
- text
- The text to repeat.
- number_times
- How many times to repeat. The decimal part is dropped. 0 gives empty text; a negative number gives #VALUE!.
REPT examples
Example 1. Star rating
=REPT("★", 4)"★★★★".
Example 2. Score bar
=REPT("|", B2/10)If B2 is 75, you get 7 bars (7.5 loses its decimal part).
Example 3. Pad with zeros
=REPT("0", 5-LEN(A2))&A2If A2 is "42", the result is "00042".
Common mistakes
A decimal count
It truncates rather than rounds. 3.9 repeats 3 times.
Length limit
A result longer than 32,767 characters gives #VALUE!.
FAQ
- Filled and empty stars together?
- Use two REPTs: =REPT("★", A2)&REPT("☆", 5-A2).
- A delimiter between copies?
- REPT cannot do that. Repeat the text with the delimiter attached and then remove the last one.