TEXT

Turn a number or date into text using an Excel format code — "yyyy-mm-dd", "#,##0.00", "0%", "000" — for labels, file names and joined strings.

Syntax

TEXT(value, format_text)
Argument Required Description
value Required The number or date to format. Text that is not a number is returned unchanged.
format_text Required An Excel number format code, in quotes.

Examples

Every example below was executed against VisiGrid engine 0.54.0 — not transcribed from another vendor's documentation. Reproduce any of them with vgrid calc.

Formula Result Notes
=TEXT(A2,"yyyy-mm-dd") 2025-09-29 A date serial as an ISO date.
=TEXT(A2,"dddd, mmmm d") Monday, September 29
=TEXT(B2,"#,##0.00") 1,234.50
=TEXT(B2,"$#,##0") $1,235 Rounded to the format, not truncated.
=TEXT(C2,"000") 007 Leading zeros for IDs and codes.
=TEXT(0.256,"0.0%") 25.6%
="Due "&TEXT(A2,"mmm d") Due Sep 29 The usual reason for TEXT — putting a formatted value into a sentence.

Why it exists

A cell’s number format only changes how the cell looks. The moment the value is joined into a string, the format is gone:

="Due "&A2  → Due 45929

TEXT applies the format inside the formula, so the result carries it:

="Due "&TEXT(A2,"mmm d")  → Due Sep 29

The result is text

TEXT(1234.5,"#,##0.00") is the text “1,234.50”, not a number. It will not add up, sorts as text, and cannot feed arithmetic without VALUE turning it back. Use TEXT at the edge — labels, messages, file names — and keep the number itself for calculation.

Common codes

Code1234.5 or 45929 becomes
01235
0.001234.50
#,##01,235
0%on 0.256: 26%
000on 7: 007
yyyy-mm-dd2025-09-29
mmm d, yyyySep 29, 2025
ddddMonday
h:mm AM/PMon 0.75: 6:00 PM

The codes are the same ones a cell’s custom number format uses, so a format that looks right in a cell gives the same text in TEXT.

Excel compatibility

Matches Excel for number, percentage, currency, date and time codes, including multi-section codes such as "0;(0)".

Related functions

Last updated