Excel REPT function

Summary

The Excel REPT function repeats text a given number of times. This function is often used for creating simple repeated patterns in text, or for padding text to a certain length for alignment purposes.

Syntax
				
					=REPT(text, number_times)
				
			
  • text: The text to repeat
  • number_times: The number of times to repeat the text
Return value
A text string with the specified text repeated the given number of times.

How to use

REPT is useful for text formatting, especially when you need to create uniform text patterns or spaces. It can be used for visual effects in data presentation or to ensure consistent text length for layout purposes.

Examples

Simple REPT
Repeating a Character Multiple Times: To repeat a single character:
				
					=REPT("*", 5)
				
			
This formula creates a string of 5 asterisks: “*****”.
REPT for Text Padding
Padding Text to Align in Columns: Using REPT for adding spaces for alignment:
				
					=A1 & REPT(" ", 10 - LEN(A1))
				
			
Adds spaces to the text in A1 to ensure a total length of 10 characters.
REPT in Data Presentation
Creating a Simple Bar Graph: Using REPT to visually represent data as a bar graph:
				
					=REPT("█", B2 / 10)
				
			
If B2 is 50, this formula creates a bar 5 characters long.
REPT for Decorative Text
Creating Patterns or Borders in Text: Generating a text-based decorative pattern:
				
					=REPT("-=", 10)
				
			
Produces a dashed line pattern: “-=-=-=-=-=-=-=-=-=-=”.
REPT with Line Breaks
Repeating Text with Line Breaks: Creating a multi-line repeated pattern:
				
					=REPT("Line" & CHAR(10), 3)
				
			
Repeats the word “Line” three times, each on a new line.

Additional Notes

  • REPT can only repeat text, not numbers or formulas.
  • Be mindful of the overall length of the resulting text, as excessively long repetitions may not display as intended.
  • Useful in creative solutions for data visualization and text formatting within Excel’s grid structure.

Related Functions

Excel FIND function

The Excel FIND function locates one text string within another, returning the start position, crucial for text analysis.

Excel REPLACE function

The Excel REPLACE function substitutes part of a text string with a different text string, ideal for data correction and manipulation.

Content Navigation