Description:
This function repeats text a given number of times. Use REPT to fill a cell with a number of instances of a text string.
Syntax: REPT (Text, Number_times)
Remarks
Example
The REPT function can be used in any database where you have stored any text values which you want to use to repeat a few number of times to populate another cell intersection. It could be an instance where you want to fill some characters repeatedly in a cell, or you may need to fill some numbers as characters within a cell a certain number of times. The function returns the text value repeated as many times as given in the second parameter.
=REPT ("A", 3) |
-equals "AAA" |
=REPT ("0", 3) |
-equals "000" |
=REPT ("Frank" , 2) |
-equals "FrankFrank" |
Note: A number supplied within double quotes is taken as a string parameter.
Let us take the example of a database in PowerOLAP where we have certain text values for name, last name, city, country etc., and we need to manipulate these text values and arrive at results with different permutations and combinations. We shall use this example in this case to replace some characters for the member called "Last Name" (which is the parameter that has the values for people's names), and the characters in the specified intersection will be read and repeatedly filled into the intersection specified.
In this case, we have written a formula in the appropriate cube in PowerOLAP, pulling in the value from the above mentioned parameters and then writing a value into another intersection, repeating it a number of times as specified.
The formula above writes values into the "StringDataFunctions" cube to the "String Data Manipulations" dimension into the member named "REPT" by writing the text value specified as a reference for the member "Last Name" and the number of times this value has to be repeated is 3. The result returned by the function is the text value in "Last Name" concatenated and repeated 3 times as written in the formula above.