# The Excel REPT Function

## Function Description

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

The syntax 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 three examples of the Excel Rept function.

Formulas:
A
1=REPT( "ha", 8 )
2=REPT( "ha", 0 )
3="/ " & REPT( "*", 20 ) & " /"
Results:
A
1hahahahahahahaha
2
3/ ******************** /

Note that in the above example spreadsheet:

• In cell B2, the number_times argument is set to 0, so the Rept function returns the empty string;
• In cell B3, the '&' operator has been used with the Rept function, to join together different text strings.

For further examples of the Excel Rept function, see the Microsoft Office website.

## Rept Function Error

If you get an error from the Excel Rept Function, this is likely to be the #VALUE! error:

Common Error
 #VALUE! - Occurs if the result of the Rept function is more than 32,767 characters long.