Page 249 - Excel 2007 Bible
P. 249
17_044039 ch12.qxp 11/21/06 11:05 AM Page 206
Part II
Working with Formulas and Functions
When a number isn’t treated as a number
f you import data into Excel, you may be aware of a common problem: Sometimes the imported values are
Itreated as text. Here’s a quick way to convert these non-numbers to actual values. Activate any empty cell
and choose Home ➪ Clipboard ➪ Copy (or press Ctrl+C). Then select the range that contains the values you
need to fix. Choose Home ➪ Clipboard ➪ Paste Special. In the Paste Special dialog box, select the Add oper-
ation and then click OK. This procedure essentially adds zero to each cell — and, in the process, forces Excel
to treat the non-numbers as actual values.
Excel may display a Smart Tag to identify numbers stored as text. If the cell contains a Smart Tag, you’ll see a
small rectangle in the upper left corner of the cells. Activate the cell, and you can respond to the Smart Tag.
To force the number to be treated as an actual number, select Convert To Number on the Smart Tag’s list of
options.
Numbers as text
As I mentioned, Excel distinguishes between numbers and text. If you want to force a number to be consid-
ered as text, you can do one of the following:
n Apply the Text Number format to the cell. To do so, use the Number Format drop-down list on
the Number group of the Home tab. If you haven’t applied other horizontal alignment formatting,
the value will appear left-aligned (like normal text) in the cell.
n Precede the number with an apostrophe. The apostrophe isn’t displayed, but the cell entry will be
treated as if it were text.
Even though a cell is formatted as Text (or it uses an apostrophe), you can still perform some mathematical
operations on the cell if the entry looks like a number. For example, assume cell A1 contains a value pre-
ceded by an apostrophe. The formula that follows displays the value in A1, incremented by 1:
=A1+1
Functions, however, treat the contents of cell A1 as 0, which gives you an incorrect result. Here’s an
example:
=SUM(A1:A10)
Bottom line? Be aware of Excel’s inconsistency in how it treats a number formatted as text; the accompany-
ing sidebar is a good place to start.
Text Functions
Excel has an excellent assortment of worksheet functions that can handle text. You can access these func-
tions just where you’d expect: from the Text control in the Function Library group of the Formula tab.
206