returns a text string which includes repetitions of another text string.
REPT(text, number)
returns number copies of text, joined together.
REPT("ha", 7)
returns hahahahahahaha!
REPT(ROUND(RAND()*10), 3)
returns nnn where n is a random digit repeated three times, while:
CONCATENATE(ROUND(RAND()*10), ROUND(RAND()*10), ROUND(RAND()*10))
returns xyz where x, y, z are three randomly independent digits.
Here is an application of using the REPT function for data normalization and display.
Let's say you have a list of employee IDs, and for data entry consistency, you need to ensure that every ID is exactly 10 characters long. Some IDs were entered with fewer characters, and they need to be padded with leading zeros.
The Data:
Employee ID | ||
|---|---|---|
A | ||
1 | 12345 | |
2 | 987654 | |
3 | 543210987 | |
4 | 10 | |
5 | 9999999999 |
The Goal:
Pad the Employee ID with leading zeros so that every ID has a total length of 10 characters.
The Formula:
In a new column (let's say Column B), you would enter the following formula for the first employee ID, assuming the Employee ID is in cell A1:
REPT("0", 10-LEN(A1)) & A1
Explanation of the Formula:
The Resulting Table:
Employee ID | Formatted Employee ID | ||
|---|---|---|---|
A | B | ||
1 | 12345 | 0000012345 | |
2 | 987654 | 0000987654 | |
3 | 543210987 | 0543210987 | |
4 | 10 | 0000000010 | |
5 | 9999999999 | 9999999999 |
PRODUCT & FEATURES
RESOURCES
Terms | Privacy | Spam Policy
© 2026 Zapof