The Excel REPT function
repeats characters a given number of times. For example, =REPT("x",5)
returns "xxxx".
Syntax
The syntax for the REPT
function in Microsoft Excel is:
REPT( text, number )
Parameters or Arguments
text
The text value to repeat.
number
The number of times to repeat
the text value.
Note:
-
If number
is zero, the function returns an empty string;
-
If number
is a decimal, it is truncated to an integer.
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
|
1
|
hahahahahahahaha
|
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.
Common Error
#VALUE!
Occurs if the result of the
Rept function is more than 32,767 characters long.
Reference:
follow us on
http://arivilm.blogspot.in
like us on
https://www.facebook.com/Arivilm2501/
No comments:
Post a Comment