TEXT function

TEXT() function

Star InactiveStar InactiveStar InactiveStar InactiveStar Inactive
 

Format numbers as text by applying format codes.

TEXT(value, format_text)


Apply format codes to numbers to format them as text and, optionally, embed them inside text strings. The TEXT function can be applied to either defined values (e.g. 1234), cell references (e.g. C3) or the result of other formulas.

TEXT syntax requires the 'defined value or cell reference to be formatted' and 'the format code to apply'.


TEXT examples

In the examples below, the TEXT function is used to format numbers in a variety of formats, from currency to fractions to scientific or custom formats.

Use the TEXT function to format numbers as text by applying format codes.

Use the TEXT function to format numbers as text by applying format codes.

Syntax

TEXT(value, format_text)

The TEXT function consists of 2 arguments:

  1. value. Required. The number to format.
  2. format_text. Required. The format code to apply.

Try it now!

Enter your formulas into the grey cells.


Scope

The TEXT function can be applied to defined numeric values, cell references or the results of other formulas.

  • Numeric value:
  =TEXT(1234.567,"$#,##0.0") || returns the text string '$1,234.6'.
  • Cell references:
  =TEXT((C3/C4),"0%") || returns the text string '25%' if cell C3 = 25 and cell C4 = 100.
  • Formulas:
  =TEXT(TODAY(),"dd-mmm-yyyy") || returns '26-Mar-2022' as today's date.
  • Text strings:
  ="Today's date is "&TEXT(TODAY(),"dd-mmm-yyyy") || returns 'Today's date is 26-Mar-2022'.

Caveats

  • The TEXT function returns a number formatted as text.
  • The format_text argument must appear in double quotation marks.
  • It is recommended to retain the original value in case further calculations using that number are required. Referencing a value formatted by the TEXT function may be difficult later.
  • The TEXT function can be combined with other text functions to format longer text strings. For example, ="Today's date is"&CHAR(10)&"&UPPER(TEXT(TODAY(),"dd-mmm-yyyy")) || returns 'Today's date is' followed by a line break (using the CHAR function) and then the uppercase date '26-MAR-2022' (using the UPPER function).

Functions Category

 

Register (for free!) or Login to access bonus materials

About xlsnippets

Learn how to master functions, charts, pivot tables and more using Excel for Microsoft Office 365. Simple instructions and embedded spreadsheets help you practise the basics.

Latest Updates

26 March 2022
26 March 2022
26 March 2022
25 March 2022
22 March 2022

Coming soon

xlsnippets.com is currently in beta version. More functions and bonus content for registered users will be added weekly. Detailed training courses with additional downloadable resources are also on the horizon!