29.05.2016 Views

Excel 2010 Fomulas

Create successful ePaper yourself

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

120<br />

Part II: Using Functions in Your Formulas<br />

Numbers as text<br />

As I mentioned, <strong>Excel</strong> distinguishes between numbers and text. If you want to “force” a number<br />

to be considered as text, you can do one of the following:<br />

Apply the Text number format to the cell. Select Text from the Number Format dropdown<br />

list, which can be found at Home➜Number. If you haven’t applied other horizontal<br />

alignment formatting, the value will appear left-aligned in the cell (like normal text), and<br />

functions like SUM will not treat it as a value. Note, however, that it doesn’t work in the<br />

opposite direction. If you enter a number and then format it as text, the number will be<br />

left-aligned, but functions will continue to treat the entry as a value.<br />

Precede the number with an apostrophe. The apostrophe isn’t displayed, but the cell<br />

entry will be treated as if it were text.<br />

Even though a cell is formatted as Text (or uses an apostrophe), you can still perform some<br />

mathematical operations on the cell if the entry looks like a number. For example, assume cell A1<br />

contains a value preceded by an apostrophe. This formula displays the value in A1, incremented<br />

by 1:<br />

=A1+1<br />

This formula, however, treats the contents of cell A1 as 0:<br />

=SUM(A1:A10)<br />

To confuse things even more, if you format cell A1 as Text, the preceding SUM formula treats it as 0.<br />

In some cases, treating text as a number can be useful. In other cases, it can cause problems.<br />

Bottom line? Just be aware of <strong>Excel</strong>’s inconsistency in how it treats a number formatted as text.<br />

When a number isn’t treated as a number<br />

If you import data into <strong>Excel</strong>, you may be aware of a common problem: Sometimes, the<br />

imported values are treated as text. Here’s a quick way to convert these nonnumbers to actual<br />

values. Activate any empty cell and choose Home➜Clipboard➜Copy. Then, select the range that<br />

contains the values you need to fix. Choose Home➜Clipboard➜Paste➜Paste Special. In the<br />

Paste Special dialog box, select the Add option and then click OK. By “adding zero” to the text,<br />

you force <strong>Excel</strong> to treat the nonnumbers as actual values.

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

Saved successfully!

Ooh no, something went wrong!