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.

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!F1
Repeat a Character

In cell F1, use REPT to repeat the asterisk "*" five times. Expected result: "*****".

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!F2
Build an In-Cell Bar Chart

In cell F2, use REPT to create a bar of 8 pipe characters "|". Expected result: "||||||||".

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!F3
Pad an ID with Leading Zeros

In cell F3, pad the value in A1 ("55") with zeros so the total length is 6. Formula: =REPT("0",6-LEN(A1))&A1.

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!F4
Create a Star Rating

In cell F4, use REPT to display 5 star characters. Formula: =REPT("★",5).

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

  • 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
Select Scenario:
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.