Microsoft Office Tutorials and References
In Depth Information
Repeating a character or string
The REPT function repeats a text string (first argument) any number of times you specify (sec-
ond argument). For example, this formula returns HoHoHo:
You can also use this function to create crude vertical dividers between cells. This example
displays a squiggly line, 20 characters in length:
Creating a text histogram
A clever use for the REPT function is to create a simple histogram (also known as a frequency
distribution ) directly in a worksheet (chart not required). Figure 5-3 shows an example of such a
histogram. You’ll find this type of graphical display especially useful when you need to visually
summarize many values. In such a case, a standard chart may be unwieldy.
The data bars conditional formatting feature is a much better way to display a simple
histogram directly in cells. See Chapter 19 for more information about data bars.
Figure 5-3: Using the REPT function to create a histogram in a worksheet range.
The formulas in columns E and G graphically depict monthly budget variances by displaying a
series of characters in the Wingdings font. This example uses the character which displays as a n,
small square in the Wingdings font. A formula using the REPT function determines the number of
characters displayed. Key formulas include