TEXT and VALUE: Converting Between the Two
About this lesson
VALUE turns text that looks like a number into a real number. TEXT turns a number into text, formatted the way you say.
- turn a number into formatted text with TEXT.
- turn a number stored as text back into a number with VALUE.
The idea
They are opposites, and they are used for different reasons. VALUE is repair work. Data imported from another system arrives with its numbers stored as text. Until they are converted they will not add up, sort or match. TEXT is presentation. It turns a number into the exact string you want to show, with the decimal places, the currency or the date format written out.
The trap is what TEXT costs. Whatever goes through it comes out as text, however numeric it looks. So a column of prices formatted with TEXT will not total, will not sort in numeric order, and will not match a price anywhere else. If the value still has to compute, format the cell instead and leave the number alone. Use TEXT when the result is going into a joined string that a person will read, and nowhere else.
The mistake to watch for
Using TEXT on a value that still has to compute. Whatever goes through TEXT comes out as text, however numeric it looks. So a column of prices formatted with TEXT will not total, will not sort in order, and will not match a price anywhere else. Format the cell instead. Keep TEXT for a string a person will read.
Read more about this
Where this comes up again
This lesson needs JavaScript to run. Everything below is the lesson in full, but you cannot type into the grid or be marked.
ISNUMBER answers TRUE for a real number, FALSE otherwise.
In D2, type:
=ISNUMBER(B2)
| Row | A | B | C | D | E | F | G |
|---|---|---|---|---|---|---|---|
| 1 | Field | Value | Converted | ||||
| 2 | Imported quantity | 1450 | |||||
| 3 | Unit price | 3.5 | |||||
| 4 | Order date | 45000 | |||||
| 5 | Percentage | 0.184 | |||||
| 6 | |||||||
| 7 | |||||||
| 8 |
Every step
-
ISNUMBERanswersTRUEfor a real number,FALSEotherwise. InD2, type:=ISNUMBER(B2). -
VALUEturns text that looks like a number into a real one. InC2, convertB2into a real number, usingVALUE. -
TEXTturns a number into formatted text. InC3, showB3as text with two decimals. Shape:=TEXT(value,"0.00"). -
TEXTformats dates the same way. InC4, showB4as day, month and four-digit year with slashes, usingTEXT. -
There is a cost to converting. Read
=ISNUMBER(TEXT(B5,"0%"))and say what it returns.