top of page

MS Excel: REPT function to repeat text string number of times

  • Writer: Fakhriddinbek
    Fakhriddinbek
  • May 2
  • 2 min read

The REPT function in Excel is used to repeat a text string a specified number of times. This can be particularly useful for data visualization, creating in-cell bar charts, or generating repeated patterns or placeholders in your spreadsheet.


Excel interface with a "Function Arguments" window open, showing REPT function details. Toolbar with formulas and empty spreadsheet cells visible.

Syntax


=REPT(text, number_times)


Parameters:


Argument

Description

text

Required. The text string you want to repeat.

number_times

Required. The number of times to repeat the text.


Returns: A single text string that repeats the original text as many times as specified.


Examples with Tables


Example 1: Simple Text Repetition


=REPT("x", 5)


Formula

Result

=REPT("x", 5)

xxxxx


Example 2: Repeat Cell Content


Assume cell A1 contains "Hi":


=REPT(A1, 3)


A1

Formula

Result

Hi

=REPT(A1, 3)

HiHiHi


Example 3: In-cell Bar Chart (Using Characters)


You can create a visual bar using the pipe (|) character:


=REPT("|", B2)


Item

Value (B)

Bar (C)

Product A

4

`

Product B

7

`

Product C

2

`

Formula in C

`=REPT("


Use Cases


Scenario

Description

Visualize numbers with bars

Simple data bars without charts

Generate padding or fill spaces

e.g., create dotted lines or placeholders

Repeat characters for formatting

e.g., "=" or "*" for visual separation

Simulate progress indicators

Useful in dashboards or forms


Notes


  • If number_times is 0, the result is an empty string ("").

  • The result of REPT cannot exceed 32,767 characters—this is the limit for Excel cells.

  • If number_times is negative or non-numeric, Excel returns a #VALUE! error.


Comparison with Similar Tools


Task

Recommended Function

Repeat text by count

REPT

Repeat based on condition

Combine REPT with IF

Repeat dynamic content

Use with TEXT or &

Repeat text by delimiter

Use TEXTJOIN (Office 365/Excel 2019+)


Related Functions


Function

Description

TEXT

Format numbers as text

CONCAT

Join text strings (modern version of CONCATENATE)

TEXTJOIN

Combine multiple text strings with a delimiter

REPLACE

Replace part of a string

SUBSTITUTE

Replace matching text in a string


Summary


Feature

Description

Function Name

REPT

Purpose

Repeat a string multiple times

Use Cases

In-cell charts, formatting, placeholders

Result

Text string

Max Output

32,767 characters


Final Thoughts


The REPT function is deceptively simple but extremely powerful when combined with formulas for dashboards, progress bars, or even text-based layouts. It helps bring data to life directly within your spreadsheet without relying on external visuals or tools.

Comentários


bottom of page