Converting Forced Text to Numbers

When you enter information in a worksheet, Excel does its best to decipher what type of data you are entering. If your entry can be translated as a number or a date, then Excel treats it that way. You can overcome this natural tendency of Excel by formatting a cell as text before entering information in it. When you do, the information in the cell is always treated as text.

Of course, forcing Excel to treat your input as text can have unwanted repercussions later. For instance, you may decide that you want to add up the contents of cells that are formatted as text. If you use a formula such as the following, then Excel has no problem:

=A1 + A2

Excel provides the correct sum, provided at least one of the cells (A1 or A2) was not formatted as text. To make matters tricky, however, if you use the SUM function (which most people do when summing an entire column or row), then you won’t get the proper sum. The SUM function ignores any cells formatted as text. How do you get around this?

It is possible to remove the text formatting attribute from the cells you want to sum, but that won’t cause Excel to reassess the contents of the cells and treat them as numbers or dates, where appropriate. There are several different ways you can force the conversion of forced text into numeric values, ranging from macros to using formulas in other columns to perform the conversion. The following three solutions, however, seem to be the easiest and quickest.

First, select the cells that are formatted as text, but that actually contain numbers. You may see a small exclamation mark icon appear near the upper-left corner of the selected cells. (See Figure 1.)

Figure 1. The exclamation mark icon.

Click the icon and some options appear. You want to select the Convert to Number option. Excel immediately changes the format on the cells (to General) and converts the text values to numbers.

If you don’t see the exclamation mark icon when you select the cells, then you can use a different method to do the conversion:

  1. Enter the value 1 in an empty cell.
  2. Select the cell and press Ctrl+C. The value is now in the Clipboard.
  3. Select the range of cells you want to convert to numbers.
  4. Display the Home tab of the ribbon.
  5. Click the down-arrow under the Paste tool and choose Paste Special from the resulting choices. Excel displays the Paste Special dialog box. (See Figure 2.)
  6. Figure 2. The Paste Special dialog box.

  7. Make sure the Multiply radio button is selected.
  8. Click on OK.

This works because Excel multiples each cell in the range (step 3) by the value in the Clipboard and then again stores the value in the cell. Since any number multiplied by one is that same number, you effectively force Excel to replace the contents of the cell with the numerical equivalent of the text that was previously there.

You could also, if desired, select a blank cell in steps 1 and 2. When it comes to step 6, choose Add instead of Multiply. The result is that a zero value (what Excel assumes for a blank cell) is added to the target values and they are converted, again, to numbers.

If the range you want to convert contains only numbers formatted as text and not any actual text, then the following steps work well:

  1. Select the range of cells you want to convert to numbers.
  2. Display the Data tab of the ribbon.
  3. Click the Text to Columns tool in the Data Tools group. Excel displays the Convert Text to Columns Wizard. (See Figure 3.)
  4. Figure 3. The Convert Text to Columns Wizard.

  5. Click on Finish.

If you try these three steps on a range of cells that has text containing spaces or tabs, it is possible that you could overwrite data in columns to the right of the selected range. That is why it is safest to use if the range only contains numeric values formatted as text.