REPT Function

Excel 2007+

Summary

The Excel REPT function repeats a specified text string a given number of times. It's perfect for creating visual separators, filling cells with repeating patterns, or generating custom progress bars and formatting elements within Excel cells.

Syntax

REPT(text, number_times)

Parameters

Parameter Type Required Description
text Text Yes The text string to repeat (can include numbers, symbols, or formulas)
number_times Number Yes Positive integer specifying how many times to repeat the text

Using the REPT Function

REPT excels at creating visual elements in spreadsheets. Use it to build progress bars, separate data sections with decorative lines, create repeating headers, or generate custom cell padding. The function handles text truncation automatically and provides immediate visual feedback in cells.

Common REPT Examples

Create Visual Separators

=REPT("*-", 5)

Generates a decorative line: *-*-*-*-* perfect for separating data sections.

Build Progress Bars

=REPT("█", B2/10)

Creates a solid progress bar based on percentage in B2 (assuming B2 contains 0-100).

Cell Padding/Fillers

=REPT(" ", 20-C2)

Pads short text in C2 to fixed 20-character width with spaces.

Simple Repeat Example

=REPT("→ ", 3)

Repeats arrow symbol three times: → → →

Frequently Asked Questions

REPT returns an empty string "" when number_times is 0.

Yes, but it truncates decimals to integers (3.7 becomes 3).

Maximum 32,767 characters. Longer results return #VALUE! error.

Common Errors and Solutions

#VALUE! error

Cause: Result exceeds 32,767 characters

Solution: Reduce number_times or shorten text parameter

Unexpected truncation

Cause: number_times contains decimal

Solution: Use INT() function: REPT(text, INT(number_times))

No repetition occurs

Cause: number_times is 0 or negative

Solution: Ensure number_times is positive integer

Notes

  • Result cannot exceed 32,767 characters
  • Non-integer number_times gets truncated
  • Zero or negative number_times returns empty string
  • Works with formulas in text parameter
  • Excellent for dashboard visual elements

Compatibility

Available in: Excel 2007, Excel 2010, Excel 2013, Excel 2016, Excel 2019, Excel 2021, Microsoft 365

Not available in:

Content last reviewed: December 9, 2025
Update frequency: As needed
Excel versions tested: Excel 2007+