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.
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.
The most common uses:
=REPT("★", 4) & REPT("☆", 1) gives ★★★★☆ for a 4-out-of-5 rating=REPT("|", A2) where A2 contains a number — produces an in-cell horizontal bar of that length=REPT("0", 5-LEN(A2)) & A2 for fixed-width formatting=REPT("test ", 100) generates a long string for paste testingExcel 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.
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.
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.
Use the REPT function in Google Sheets to duplicate text. Includes ARRAYFORMULA combinatio...
Three ways to repeat text in Microsoft Word: paste-special method, Quick Parts AutoText, a...
Standard Notepad has no repeat function, but Notepad++ does it with macros. Step-by-step g...