TEXT function
Formats a number or date as text using a format code such as "#,##0.00", "0%" or "dd-mmm-yyyy", e.g. for use in sentences and labels.
Available in All versions of Excel, including Microsoft 365, Excel for Mac and Excel for the web
In every Excel versionWorks in Google Sheets
Syntax
TEXT(value, format_text)| Argument | What it means | |
|---|---|---|
value | Required | The number, date or time to format (or a cell containing it). |
format_text | Required | A number format code in double quotes, written the same way as in Format Cells > Custom, e.g. "#,##0.00". |
Returns: Text that looks the way the format code describes.
How TEXT works
Cell formatting only changes how a number looks; the moment you join it with text using & or CONCAT, Excel uses the raw value, so a price of $1,234.50 becomes 1234.5 and a date becomes a serial number like 46096. TEXT solves this. It applies any number format you choose and returns the result as text, ready to be dropped into labels such as "Invoice due 15-Mar-2026" or "Margin: 18.3%".
The format code is the same language used in Format Cells > Number > Custom: 0 shows a digit (padding with zeros), # shows a digit only if needed, , adds thousands separators, . sets the decimal point, % multiplies by 100 and adds a percent sign. For dates d, m, y are day, month and year - dd gives two digits, mmm the short month name, mmmm the full month name, ddd/dddd the weekday. Common format codes (value → result): "0" 1234.567 → 1235 · "0.00" 1234.567 → 1234.57 · "#,##0" 1234.567 → 1,235 · "#,##0.00" → 1,234.57 · "$#,##0.00" → $1,234.57 · "0%" 0.256 → 26% · "0.0%" 0.256 → 25.6% · "000000" 742 → 000742 · "0.00E+00" 1234.567 → 1.23E+03 · "dd-mmm-yyyy" 2026-03-15 → 15-Mar-2026 · "yyyy-mm-dd" → 2026-03-15 · "mmmm yyyy" → March 2026 · "ddd" → Sun · "dddd" → Sunday · "hh:mm" 0.75 → 18:00 · "h:mm AM/PM" 0.75 → 6:00 PM · "# ?/?" 2.5 → 2 1/2.
The result is text, so it cannot be summed and is left-aligned. Keep the original number for calculations and use TEXT only where you need it displayed. Format codes are language-specific: a German Excel expects "TT.MM.JJJJ" instead of "dd.mm.yyyy", which can break shared workbooks.
Examples
1Thousands separator and two decimals
| A | B | C | |
|---|---|---|---|
| 1 | Item | Amount | |
| 2 | Freight | 1234.5 | 1,234.50 |
Result: 1,234.50
The comma adds a thousands separator and .00 forces two decimals.
2Due date in a sentence
| A | B | C | |
|---|---|---|---|
| 1 | Invoice | Due date | |
| 2 | INV-0098 | 2026-03-15 | Invoice INV-0098 due 15-Mar-2026 |
Result: Invoice INV-0098 due 15-Mar-2026
B2 is a real date (serial 46096). Without TEXT the sentence would end with 46096.
3Day of the week
| A | B | |
|---|---|---|
| 1 | Delivery date | |
| 2 | 2026-03-15 | Sunday |
Result: Sunday
dddd returns the full weekday name; 15 March 2026 is a Sunday.
4Percentage in a label
| A | B | C | |
|---|---|---|---|
| 1 | Product | Margin | |
| 2 | Desk Lamp | 0.1834 | Desk Lamp margin: 18.3% |
Result: Desk Lamp margin: 18.3%
The % code multiplies by 100 and adds the sign; 0.0 keeps one decimal.
5Leading zeros for IDs
| A | B | |
|---|---|---|
| 1 | Employee no. | |
| 2 | 742 | 000742 |
Result: 000742
Each 0 is a required digit, so the number is padded to six digits.
Common errors and how to fix them
| Error | Why it happens | Fix |
|---|---|---|
#VALUE! | The format code is invalid (for example unbalanced quotes). | Test the code first in Format Cells > Custom, then copy it into TEXT. |
#NAME? | The format code was typed without double quotes, e.g. TEXT(A2,dd-mm-yyyy). | Always put format_text in quotes. |
Tips
- Find any format code you like by opening Format Cells > Custom on a formatted cell and copying the code shown there.
- Wrong-looking date output (like
15-Mar-yyyy) usually means your Excel uses another language for date codes; use the local letters. =TEXT(A2,"mmm")gives a month name for grouping and reports;=TEXT(A2,"yyyy-mm")gives sortable year-month keys.- Use
"[h]:mm"to show total hours above 24, e.g. for timesheets: 1.5 days →36:00.
Questions
Why does my date show as a number when I join it with text?
Dates are stored as serial numbers (2026-03-15 is 46096). Wrap the date in TEXT, e.g. TEXT(B2,"dd-mmm-yyyy"), before joining.
Can I calculate with the result of TEXT?
Not reliably - it is text. Keep the original value for maths and convert back with VALUE only if you must.
How do I show a number in thousands, like 12.5K?
Use a trailing comma, which divides by 1,000: =TEXT(12500,"0.0,")&"K" returns 12.5K.
Google Sheets
TEXT also exists in Google Sheets and works the same way for everyday use, so the examples above work there too.
TEXT in other languages
In a non-English version of Excel the function has a local name. Excel translates formulas automatically when a file is opened in another language.
| Language | Function name |
|---|---|
| Czech | HODNOTA.NA.TEXT |
| Danish | TEKST |
| Dutch | TEKST |
| Finnish | TEKSTI |
| French | TEXTE |
| Hungarian | SZÖVEG |
| Italian | TESTO |
| Norwegian (Bokmål) | TEKST |
| Polish | TEKST |
| Portuguese (Brazil) | TEXTO |
| Portuguese (Portugal) | TEXTO |
| Russian | ТЕКСТ |
| Spanish | TEXTO |
| Turkish | METNEÇEVİR |
Recipes that use TEXT
- How to convert a date to text in Excel
- How to convert decimal hours to time in Excel
- How to create a progress bar in Excel cells
- How to get the quarter from a date in Excel
- How to sum time over 24 hours in Excel
- How to sum values by month in Excel