← All how-to recipes

How to use the TEXT function

✓ Verified in LibreOffice 25.8.7.3

Format a number or date as text in a pattern you control — for labels, sentences, and reports.

The formula

AppFormulaNotes
Excel=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. Every formula here is confirmed by actually executing it.