REPT Function
REPT Function

REPT Function

Repeats a text string a specified number of times.

ExcelClash Team
PUBLISHED

Summary

The Excel REPT function repeats a text string a specified number of times. For example, =REPT("*",5) returns "*****". The result is always one text string.

REPT is simple, but it has several useful worksheet patterns. It can build in-cell bars, create star ratings, and pad short values with leading zeros when combined with LEN.

That gives REPT a small but practical role in reporting and text layout. It can pad IDs, create repeated separators, or build simple in-cell bars for quick visual cues. The function is straightforward, but it becomes useful anytime repetition itself is the formatting rule.

Purpose

Repeat text

Returns the same text over and over based on the count you provide.

Return Value

A text string

Returns repeated text. If the repeat count is 0, the result is an empty string.

Syntax

=REPT(text, number_times)

text is the character or string to repeat. number_times is how many times it should be repeated. Both arguments are required.

Arguments

  • text - [Required] The text or character to repeat.
  • number_times - [Required] The number of repetitions. Decimals are truncated, and 0 returns an empty string.

REPT vs Other Functions

REPT is usually paired with other functions rather than compared directly to them. LEN helps when you need fixed-width padding, and simple math can scale a bar or rating before REPT displays it.

Pattern Example Use When
Simple repeat =REPT("*",5) You need the same symbol repeated a fixed number of times
Bar display =REPT("|",A1) You want a quick visual bar
Zero padding =REPT("0",6-LEN(A1))&A1 You need a fixed-width ID
Rating display =REPT("★",A1) You want a visual rating inside a cell

Using REPT

One common use of REPT is building simple visuals without charts. Repeating a symbol such as | or can turn a number into a bar or a rating that is easy to scan in a table.

Another common use is padding values to a fixed length. If an ID must always be 6 characters long, =REPT("0",6-LEN(A1))&A1 adds only the zeros that are missing.

  • Use REPT for repeated symbols, simple bars, and star ratings.
  • Use REPT with LEN when a value needs leading zeros.
  • Remember that REPT returns text, even when the repeated characters are digits.

Example 1 - Repeating a Character a Fixed Number of Times

This is the direct use of REPT. Excel repeats the text exactly the number of times you request and joins the result into one string.

=REPT("*", 5)   // "*****"
=REPT("-", 20)  // separator line
=REPT("ha", 3)  // "hahaha"
Check Answer
Challenge #1
Target: Sheet1!B1

In cell B1, repeat a symbol a fixed number of times.

Example 2 - Building an In-Cell Bar Chart

REPT can turn a value into a quick visual. The more times the symbol is repeated, the longer the bar becomes. This is a lightweight alternative to inserting a full chart.

=REPT("|", 8)      // "||||||||"
=REPT("|", A1)     // bar length depends on A1
=REPT("|", A1/10)  // shorter scaled bar
Check Answer
Challenge #2
Target: Sheet1!B2

In cell B2, create a simple in-cell bar using repetition.

Example 3 - Padding an ID to a Fixed Length

This is one of the most practical REPT patterns. LEN measures the current length, REPT creates the missing zeros, and &A1 joins the zeros with the original value.

=REPT("0", 6-LEN(A1))&A1
// A1="55"    -> "000055"
// A1="12345" -> "012345"
Check Answer
Challenge #3
Target: Sheet1!B3

In cell B3, pad a short ID with leading zeros.

Example 4 - Creating a Star Rating Display

REPT can also turn a rating number into a visual score. This works well in reports where a quick visual cue is more useful than the raw number alone.

=REPT("★", 5)              // "★★★★★"
=REPT("★", A1)             // stars based on A1
=REPT("★", A1)&REPT("☆",5-A1)
Check Answer
Challenge #4
Target: Sheet1!B4

In cell B4, create a star-style visual rating.

REPT cannot return more than 32,767 characters. If the repeated result would be longer than that, Excel returns #VALUE!. In normal worksheet use, that limit rarely causes problems, but it is worth knowing.

Conclusion Recap

REPT is a simple function, but it does a few very useful jobs. In this lesson, it built repeated symbols, quick bars, padded IDs, and rating displays by turning one character into a longer text pattern.

The best way to think about it is visual or structural text. If you need the same character many times, REPT saves you from typing it by hand and works especially well with LEN or a numeric cell value.

  • Summary: REPT repeats text a chosen number of times.
  • Syntax: =REPT(text, number_times).
  • Key point: The result is text, not a number.
  • Practical usage: Bars, ratings, separators, and zero-padding.
  • Best pattern: Combine REPT with LEN to pad a value to a fixed total length.
Tactical Arena
Share REPT Function!

Tell your friends about this post

Discussion

ExcelClash is an interactive platform designed to level up your Excel skills through real-world exercises and challenges. Sharpen your logic, solve real spreadsheet problems, and learn faster.

© 2026 ExcelClash, Inc. All rights reserved.