Using the REPT Function

Excel includes a worksheet function that allows you to repeat a text string any number of times: REPT. For instance, suppose cell B1 contains the value 5 and cell C1 contains the following:

=REPT("*", B1)

What Excel shows is five asterisks (*****) in cell C1. REPT takes whatever is in the quote marks and repeats it the number of times specified. If the string is more than one character, then it is also repeated that number of times. For instance, consider the following:

=REPT("/", B1)

Assuming B1 still contains the value 5, the formula results in a ten-character string: /////. If you don’t typically wax graphic or want to use Excel’s charting features, you can use the REPT function to create simple histograms of your data.

The only caveat is that the string created by REPT cannot be any longer than 32,767 characters. If you exceed this limit you won’t get an error, you just get a truncated string.