11.08.2013 Views

Excel's Formula - sisman

Excel's Formula - sisman

Excel's Formula - sisman

SHOW MORE
SHOW LESS

Create successful ePaper yourself

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

130<br />

Part II: Using Functions in Your <strong>Formula</strong>s<br />

Assign the Wingdings font to cells E3 and G3, and then copy the formulas down the columns to<br />

accommodate all the data. Right-align the text in column E and adjust any other formatting.<br />

Depending on the numerical range of your data, you may need to change the scaling. Experiment<br />

by replacing the 100 value in the formulas. You can substitute any character you like for the n in<br />

the formulas to produce a different character in the chart.<br />

The workbook shown in Figure 5-3, text histogram.xlsx, also appears on the companion<br />

CD-ROM.<br />

Padding a number<br />

You’re probably familiar with a common security measure (frequently used on printed checks) in<br />

which numbers are padded with asterisks on the right. The following formula displays the value<br />

in cell A1, along with enough asterisks to make 24 characters total:<br />

=(A1 & REPT(“*”,24-LEN(A1)))<br />

Or if you’d prefer to pad the number with asterisks on the left, use this formula:<br />

=REPT(“*”,24-LEN(A1))&A1<br />

The following formula displays asterisk padding on both sides of the number. It returns 24 characters<br />

when the number in cell A1 contains an even number of characters; otherwise, it returns 23<br />

characters.<br />

=REPT(“*”,12-LEN(A1)/2)&A1&REPT(“*”,12-LEN(A1)/2)<br />

The preceding formulas are a bit deficient because they don’t show any number formatting. Note<br />

this revised version that displays the value in A1 (formatted), along with the asterisk padding on<br />

the left:<br />

=REPT(“*”,24-LEN(TEXT(A1,”$#,##0.00”)))&TEXT(A1,”$#,##0.00”)<br />

Figure 5-4 shows this formula in action.<br />

Figure 5-4: Using a formula to pad a number with asterisks.

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

Saved successfully!

Ooh no, something went wrong!