REPT function

Description

function repeats a piece of text a specified number of times. Use REPT to fill a cell with a number of instances of a text string.

Syntax

REPT(text,number_times)

Parameters

text: is the character or string you want to repeat
number_times: is the number of times to repeat text

Remarks

  1. If number_times is 0 (zero), REPT returns "" (empty text).
  2. If number_times is omitted, REPT returns "" (empty text).
  3. If number_times is not an integer, it is truncated.
  4. The result of the cannot be longer than 32,767 characters, or REPT returns #VALUE!.
The example may be easier to understand if you copy it into cell A1 of a blank worksheet. (not include the header and index number)
1
2
3
4
5
A B C
Formula Result Description
=REPT("A",0) number_times is 0 (zero), REPT returns "" (empty text).
=REPT("A",) number_times is omitted, REPT returns "" (empty text).
=REPT("A",32768) #VALUE! number_times > 32767, returns #VALUE!
=REPT("A",3.9) AAA number_times is not an integer, it is truncated, 3.9=3.

Examples

Padding a Cell

The REPT() function is sometimes used to pad a cell with characters.

1
2
3
4
5
A B C
Formula Result Description
=REPT("-",5) ----- displays a dash 5 times.
=REPT(".",3)&" by Justin" ...by Justin add leading dots in a cell.
="Read More"&REPT(".",3) Read More... add trailing dots in a cell.
="<!-- "&REPT("*",6)&" -->" <!-- ****** --> displays the string 6 times.

Building Text Charts

A more common use for the REPT() function is to build text-based charts. For example, you can use it to create , please read: How To Create Sparklines Use Excel Functions.

In this case, you use a numeric result in a cell as the REPT() function’s number argument, and the repeated character then charts the result.

You can format the chart cells with the Webdings font or Playbill font. if the character you want to repeat is g, please use Webdings font, if the character you want to repeat is |, please use Playbill font. see example:

REPT Function Examples

formulas:

B2=REPT(“g”, 3)
B4=REPT(“|”, 10)

Video training

https://www.youtube.com/watch?v=BRcTGXF311w

See also: Excel text functions

ASC
Changes full-width (double-byte) English letters or katakana within a character string to half-width (single-byte) characters
BAHTTEXT
Converts a number to text, using the ß (baht) currency format
CHAR
Returns the character specified by the code number
CLEAN
Removes all nonprintable characters from text
CODE
Returns a numeric code for the first character in a text string
CONCATENATE
Joins several text items into one text item
DOLLAR
Converts a number to text, using the $ (dollar) currency format
EXACT
Checks to see if two text values are identical
FIND, FINDB
Finds one text value within another (case-sensitive)
FIXED
Formats a number as text with a fixed number of decimals
WIDECHAR
Changes half-width (single-byte) English letters or katakana within a character string to full-width (double-byte) characters
LEFT, LEFTB
Returns the leftmost characters from a text value
LEN, LENB
Returns the number of characters in a text string
LOWER
Converts text to lowercase
MID, MIDB
Returns a specific number of characters from a text string starting at the position you specify
PHONETIC
Extracts the phonetic (furigana) characters from a text string
PROPER
Capitalizes the first letter in each word of a text value
REPLACE, REPLACEB
Replaces characters within text
REPT
Repeats text a given number of times
RIGHT, RIGHTB
Returns the rightmost characters from a text value
SEARCH, SEARCHB
Finds one text value within another (not case-sensitive)
SUBSTITUTE
Substitutes new text for old text in a text string
T
Converts its arguments to text
TEXT
Formats a number and converts it to text
TRIM
Removes spaces from text
UPPER
Converts text to uppercase
VALUE
Converts a text argument to a number

Leave a Reply

Your email address will not be published. Required fields are marked *