Excel tutorial

How to repeat text in Excel.

Excel has a built-in function called REPT that duplicates any text a specified number of times. Here's how to use it, including a few useful combinations.

The REPT function syntax

Excel's REPT function takes two arguments: the text to repeat, and the number of times to repeat it.

=REPT(text, number_times)

Example: =REPT("ha", 5) returns hahahahaha. The result is a single cell containing the repeated text — not 5 separate cells.

Practical examples

The most common uses:

  • Star ratings: =REPT("★", 4) & REPT("☆", 1) gives ★★★★☆ for a 4-out-of-5 rating
  • Bar chart in a cell: =REPT("|", A2) where A2 contains a number — produces an in-cell horizontal bar of that length
  • Padding numbers with leading zeros: =REPT("0", 5-LEN(A2)) & A2 for fixed-width formatting
  • Filling cells for test data: =REPT("test ", 100) generates a long string for paste testing

Limits and gotchas

Excel limits the output of REPT to 32,767 characters. If number_times × LEN(text) exceeds this, the formula returns #VALUE!. The function also returns an empty string if number_times is zero, and an error if it's negative.

For larger outputs, use our browser-based text repeater instead — it supports up to 100,000 repetitions and outputs that you can paste back into Excel as a value.

REPT vs. Power Query vs. our online tool

If you're working with a few hundred repetitions for a single cell, REPT is the fastest option. If you need to generate test data for many rows, Power Query's "Add Column" with a custom formula is more flexible. If you need a one-off long string for testing or pasting elsewhere, our online repeater is faster than spinning up Excel.

Common questions

Frequently asked.

32,767 characters. Beyond that you get a #VALUE! error.

Yes — Google Sheets has the same REPT function with identical syntax. We have a dedicated guide for Google Sheets.

You include the separator in the text itself. For comma-separated, use =REPT("hello, ", 5) which gives hello, hello, hello, hello, hello, (with a trailing comma you may want to trim).

Yes. =REPT(A1, B1) repeats whatever's in A1 the number of times given in B1.

Related reading

More articles.