MS-Excel / General Formatting

Using the TEXT Functions

You can apply this logic to some of Excel's standard functions-in particular, Excel's TEXT functions. Usually, when you use any of Excel's TEXT functions and the result returned is a number, Excel will still return that number as a text value rather than as a numeric value.

Assume you have a range of cells starting from $A$1. Each cell contains a dollar amount, followed by a space, then a person's name. Using the following formula, which combines the two TEXT functions LEFT and FIND, you can extract this dollar value:

=LEFT(A1,FIND(" ",A1)-1)

If cell A1 contains the data $22.70 Fred, the formula's result will be $22.70. However, this result will be returned as text rather than as a true numeric value; therefore, by default it will be left-aligned within the cell.

You can modify the formula so that the result is no longer a text value, but rather, a true numeric value, by adding 0 to the value:

=LEFT(A1,FIND(" ",A1)-1)+0

This will force the dollar value returned to become a true number; therefore, it will be right-aligned by default. All you need to do now is format the cell accordingly.

[Previous] [Contents]

In this tutorial:

  1. Convert Text Numbers to Real Numbers
  2. Using Paste Special
  3. Using the TEXT Functions