How to use the Excel REPT function -

Summary

The Excel REPT function repeats characters a given number of times. For example, =REPT("x",5) returns "xxxxx".

Purpose

Repeat text as specified

Return value

The repeated text.

Syntax

=REPT (text, number_times)

Arguments

  • text - The text to repeat.
  • number_times - The number of times to repeat text.

Version

Excel 2003

Usage notes

The REPT function repeats characters a specified number of times. For example, to repeat "x" five times, you can use the following formula:

=REPT("x",5) // returns "xxxxx"

Inputs to REPT can be variable. In the example shown, REPT is configured to repeat the string in column B using the count in column C. The formula in D5 is:

=REPT(B5,C5) // returns "-----"

The REPT function can be used in clever ways in more advanced formulas. See links below for specific examples.

Notes

  • Use the REPT function to repeat text a given number of times. This can be useful if you want to fill a cell, or pad values to a certain length.
  • It's possible to build a basic histogram chart using REPT, by translating values directly into a certain number of (repeated) characters.

Related videos

How to use the REPT function to repeat things In this video, we look at how to use the REPT function, a special function for repeating text values with a numeric counter.

Articole interesante...