How to use the TEXT function
✓ Verified in LibreOffice 25.8.7.3 ✓ Verified in Google Sheets (2026-08-30)Format a number or date as text in a pattern you control — for labels, sentences, and reports.
The formula
| App | Formula | Notes |
|---|---|---|
| Excel (desktop) | =TEXT(A2,"$#,##0.00") | TEXT(value, format code). The code is the same syntax as custom cell formats. |
| Google Sheets | =TEXT(A2,"$#,##0.00") | Identical. |
| LibreOffice Calc | =TEXT(A2,"$#,##0.00") | Identical. |
How it works
TEXT applies a format code to a value and returns the result as TEXT: 1234.5 with the code "$#,##0.00" becomes "$1,234.50". The codes are the same language as custom number formats — "0.0%" for percentages, "yyyy-mm-dd" for dates, "+0;-0;0" to force a sign, "[h]:mm" for durations. Its main use is building strings where a raw number would look wrong: ="Total: "&TEXT(A2,"$#,##0"). Remember the output is text, so it won't sum or sort as a number afterward — when you only need the LOOK and still need to calculate, format the cell instead of using TEXT.
Verified, not just documented
We ran =TEXT(A2,"$#,##0.00") in LibreOffice 25.8.7.3 (headless, with forced recalculation) and it returned $1,234.50 — exactly the expected result. We then ran the same formulas in Google Sheets, executed 2026-08-30: a formula-only workbook goes into Google Drive, which converts it to a Sheet and recalculates every formula with Google’s own engine, and comes back out as .xlsx carrying the values Google computed. It returned $1,234.50 for the worked example, the same value LibreOffice produced. Both engines’ numbers on this page are executed results. The Excel formula follows Microsoft’s official documented syntax — we do not run desktop Excel.
Functions used
TEXT — see full Excel, Google Sheets & LibreOffice compatibility for each.
Related recipes
- How to abbreviate large numbers as K and M
- How to add leading zeros to a number
- How to concatenate a date with text (without getting a number)
- How to convert 12-hour text times to 24-hour
- How to convert a date to text