What is the TEXT function?
=TEXT(value, format_text)TEXT turns a number into text using a format code, so you can join it with other text: "Total: "&TEXT(B2, "#,##0") or "Due "&TEXT(A2, "mmm d").
The result is text. It looks like a number or date but can no longer be used in calculations, so keep the original value for math.
Arguments
- value
- A number, a date, or a cell containing one.
- format_text
- The format code in double quotes, such as "yyyy-mm-dd", "#,##0" or "0.0%".
TEXT examples
Example 1. Date with weekday
=TEXT(46344, "yyyy-mm-dd (ddd)")The serial number 46344 is November 18, 2026. The result is 2026-11-18 (Wed).
Example 2. Thousands separators
=TEXT(1234567, "#,##0")The result is 1,234,567.
Example 3. Percentage
=TEXT(0.256, "0.0%")The result is 25.6%.
Common mistakes
Calculating with the result
TEXT returns text. Adding TEXT results may give #VALUE! or unexpected results.
m means month or minute
mm after h or before s means minutes. Elsewhere it means month.
FAQ
- Do format codes depend on language?
- Some do. Date codes can differ in some localized versions of Excel; the codes on this page are the English ones.