REPT
Cutting Up & Piecing Together Text Strings

Basic Description

The Excel Rept function returns a supplied text string, repeated a specified number of times.

The format of the function is :

REPT( text, number_times )

Where the arguments are as follows :

text - The string to be repeated
number_times - The number of times that the supplied text is to be repeated.
Note :
     -    If number_times is zero, the function returns an empty string
     -    If number_times is a decimal, it is truncated to an integer

 

The resulting text string must be no longer than 32,767 characters. If it is longer than this, the Rept function returns the Excel #VALUE! error.

 

Rept Function Examples

The following spreadsheet shows several examples of the Excel Rept function. The format of the function is shown in the spreadsheet on the left and the result is shown in the spreadsheet on the right.

Note that in the above examples:

  • In cell B2, the number_times argument is set to 0, so the Rept function returns the empty string
  • In cell B4, the the '&' operator has been used with the Rept function, to join together different text strings
Excelq.com doing business as a Service of Venttraffic Media Inc. Excel and other words on this site may be trademarks or registered trademarks of Microsoft Corporation. Microsoft Corporation is not connected in any way with this website, and makes no endorsement of the site or its related contents. All rights reserved. Website powered by Venttraffic Media Inc.