18.11.2014 Views

Microsoft Office

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Part II<br />

Working with Formulas and Functions<br />

Displaying formatted currency values as text<br />

The Excel DOLLAR function converts a number to text using the currency format. It takes two arguments:<br />

the number to convert, and the number of decimal places to display. The DOLLAR function uses the<br />

regional currency symbol (for example, a $).<br />

You can sometimes use the DOLLAR function in place of the TEXT function. The TEXT function, however,<br />

is much more flexible because it doesn’t limit you to a specific number format.<br />

The following formula returns Total: $1,287.37 (the second argument for the DOLLAR function specifies<br />

the number of decimal places):<br />

=”Total: “&DOLLAR(1287.367, 2)<br />

Repeating a character or string<br />

The REPT function repeats a text string (first argument) any number of times you specify (second argument).<br />

For example, this formula returns HoHoHo:<br />

=REPT(“Ho”,3)<br />

You can also use this function to create crude vertical dividers between cells. This example displays a squiggly<br />

line, 20 characters in length:<br />

=REPT(“~”,20)<br />

Creating a text histogram<br />

A clever use for the REPT function is to create a simple histogram (or frequency-distribution chart) directly<br />

in a worksheet. Figure 12.3 shows an example of such a histogram. You’ll find this type of graphical display<br />

especially useful when you need a visual summary of many values, and a standard chart is unwieldy.<br />

CROSS-REF<br />

The new conditional formatting features in Excel 2007 provide a much better way to display a<br />

simple histogram directly in cells. See Chapter 21 for details.<br />

FIGURE 12.3<br />

Using the REPT function to create a histogram in a worksheet range.<br />

212

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!