Quick Answer

REPT Function

Repeats text a given number of times.

✓ Excel✓ Google SheetsExcel All versions

Syntax

REPT
(text, number_times)

Parameters

ParameterDescriptionRequired
textThe text string to repeat.Required
number_timesA positive number indicating how many times to repeat text. Fractional values are truncated to integers.Required

Basic Example

Repeat a separator

=REPT("*- ",3)
Result*- *- *-

The string "*- " is concatenated three times.

Advanced Examples

Example 1: In-cell bar chart

Cell A1 holds a count like 5

Visualize with repeated bars

=REPT("|",A1)
Result: |||||
REPT draws one bar per unit, creating a quick text-based chart without a chart object.

Example 2: Pad a value with leading zeros

Make a 5-digit code from A1 = 42

Pad to a fixed width

=REPT("0",5-LEN(A1)) & A1
Result: 00042
REPT creates the needed number of leading zeros, then concatenates the number.

How REPT Works

REPT concatenates the text argument to itself number_times times. The repeat count is truncated to an integer, and if it is 0 the result is an empty string.

1
Choose the text
Decide the string to repeat.
2
Set the count
Provide how many times to repeat it.
3
Enter REPT
Type =REPT(text, count) and press Enter.

Important Notes & Limitations

  • The result is limited to 32,767 characters; longer outputs return #VALUE!.

  • number_times is truncated to an integer and must be non-negative.

  • Purely cosmetic; the repeated text is not a real chart or formatted number.

Common Errors & Fixes

#VALUE! errorThe repeated result would exceed 32,767 characters, or number_times is negative.

Fix: Reduce the repeat count so the total length stays under the limit and keep it non-negative.

Download Practice File

Practice REPT with Real Data

Download a sample CSV file with pre-populated data and practice exercises for the REPT function. Works in both Excel and Google Sheets.

Works in Google SheetsCompatible with ExcelIncludes exercises

File format: CSV (comma-separated values) - opens in Excel, Google Sheets, and all spreadsheet apps

Frequently Asked Questions

Can REPT create a bar chart?
Yes, repeating a character like "|" a number of times proportional to a value is a common in-cell chart trick.
What happens if number_times is 0?
REPT returns an empty string.
Is the repeat count rounded?
Fractional counts are truncated to an integer, not rounded.