How to Use the REPT Function in Excel

Today, we’ll explore the REPT function, an exceptionally versatile tool available in both Excel and Google Sheets. The REPT function enables you to repeat text a specified number of times and is incredibly useful for displaying patterns or creating visual elements like borders and separators in your spreadsheets.

Basic Syntax

The REPT function has a straightforward syntax:

REPT(text, number_times)
  • text: The text segment that you want to repeat.
  • number_times: The number of times to repeat the text.

Example 1: Repeating Text

For instance, to repeat the word “Hello” 3 times, the appropriate formula is:

=REPT("Hello", 3)

This formula returns: “HelloHelloHello”.

Example 2: Creating Borders

The REPT function can also be used to create textual borders. For example, to frame the word “Data” with asterisks, you might use:

=REPT("*", 5) & "Data" & REPT("*", 5)

This results in: “*****Data*****”.

Example 3: Creating Visual Separators

To visually separate items in a list using dashes, you could employ the REPT function as follows:

=A1 & REPT("-", 20-LEN(A1))

This formula appends a series of dashes after the text in cell A1, ensuring the total length reaches 20 characters.

Comparison between Excel and Google Sheets

The functionality of the REPT function is consistent across both Excel and Google Sheets, with identical syntax and application methods in both environments.

Equipped with knowledge of the REPT function, you can enhance your spreadsheets by efficiently repeating text and crafting structured visual elements.

More information: https://support.microsoft.com/en-us/office/rept-function-04c4d778-e712-43b4-9c15-d656582bb061

Other functions
Returns an array of text values from any specified range
Changes full-width (double-byte) English letters or katakana within a character string to half-width (single-byte) characters
Converts a number to text, using the ß (baht) currency format
Returns the character specified by the code number
Removes all nonprintable characters from text
Returns a numeric code for the first character in a text string
Combines the text from multiple ranges and/or strings, but it doesn't provide the delimiter or IgnoreEmpty arguments
Joins several text items into one text item
Changes half-width (single-byte) English letters or katakana within a character string to full-width (double-byte) characters
Converts a number to text, using the $ (dollar) currency format
Checks to see if two text values are identical
Finds one text value within another (case-sensitive)
Formats a number as text with a fixed number of decimals
Changes half-width (single-byte) characters within a string to full-width (double-byte) characters
Returns the leftmost characters from a text value
Returns the number of characters in a text string
Converts text to lowercase
Returns a specific number of characters from a text string starting at the position you specify
Converts text to number in a locale-independent manner
Extracts the phonetic (furigana) characters from a text string
Capitalizes the first letter in each word of a text value
Replaces characters within text
Returns the rightmost characters from a text value
Finds one text value within another (not case-sensitive)
Substitutes new text for old text in a text string
Converts its arguments to text
Formats a number and converts it to text
Combines the text from multiple ranges and/or strings, and includes a delimiter you specify between each text value that will be combined If the delimiter is an empty text string, this function will effectively concatenate the ranges
Removes spaces from text
Returns the Unicode character that is references by the given numeric value
Returns the number (code point) that corresponds to the first character of the text
Converts text to uppercase
Converts a text argument to a number
Returns text from any specified value