The purpose of the TEXT function is to convert a number to text using a specified format code.
TEXT is most often used to control the formatting of a number embedded into a text string.
Table of Contents
Syntax and example
The TEXT function takes two arguments,valueandformat_text.
Why do we need the TEXT function?
Why do we need the TEXT function?
Can’t we just apply Excel’s built-in number formatting to format numbers in a worksheet?
Keeping the number allows it to be used in standard numeric calculations.
The TEXT function, by contrast, actuallyconvertsa number to text.
The result istext, so numbers returned by TEXTcan’t be used in numeric calculations.
However, there are still many situations where TEXT is quite helpful.
The formatting is not available during concatenation.
The result is shown after the “//” marker.
TEXT with times
TEXT can format times as well as dates.
Then we use theRIGHT functionto extract just the two characters to the right, which are minutes.
The TEXT provides an elegant way to do this in a simple formula.
For a detailed explanation of how this formula works,see this page.
The TEXT function can do the same thing, and is much more versatile.
The FIXED function can be useful when concatenating a formatted number text.