The TEXT function

Formats a number as text with a number format code, for example to put it inside a sentence.

Syntax

TEXT(value, format_text)
value
The number or date to format.
format_text
A format code in quotes, such as "0%", "00000" or "dd-mm-yyyy".

Examples

B1=TEXT(0.25,"0%")
AB
125%

In plain words: Show 0.25 as a percentage with no decimals.

B1=TEXT(42,"00000")
AB
100042
B1=TEXT(1234.5,"#,##0.00")
AB
11,234.50
B1=TEXT(DATE(2024,3,5),"dd-mm-yyyy")
AB
105-03-2024

Read the guide

Questions

Why does TEXT give a different result in Danish Excel?

Format codes follow the language of Excel. Danish Excel swaps the thousands and decimal separators and uses å for year, so "dd-mm-yyyy" is written "dd-mm-åååå".

Related functions