Text function

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)
ArgumentWhat it means
valueRequiredThe number, date or time to format (or a cell containing it).
format_textRequiredA 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

C2fx=TEXT(B2,"#,##0.00")
ABC
1ItemAmount
2Freight1234.51,234.50

Result: 1,234.50

The comma adds a thousands separator and .00 forces two decimals.

2Due date in a sentence

C2fx="Invoice "&A2&" due "&TEXT(B2,"dd-mmm-yyyy")
ABC
1InvoiceDue date
2INV-00982026-03-15Invoice 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

B2fx=TEXT(A2,"dddd")
AB
1Delivery date
22026-03-15Sunday

Result: Sunday

dddd returns the full weekday name; 15 March 2026 is a Sunday.

4Percentage in a label

C2fx=A2&" margin: "&TEXT(B2,"0.0%")
ABC
1ProductMargin
2Desk Lamp0.1834Desk 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

B2fx=TEXT(A2,"000000")
AB
1Employee no.
2742000742

Result: 000742

Each 0 is a required digit, so the number is padded to six digits.

⬇Practice workbookExamples with live formulas + practice sheets · .xlsx · 19 KB

Common errors and how to fix them

ErrorWhy it happensFix
#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.

LanguageFunction name
CzechHODNOTA.NA.TEXT
DanishTEKST
DutchTEKST
FinnishTEKSTI
FrenchTEXTE
HungarianSZÖVEG
ItalianTESTO
Norwegian (Bokmål)TEKST
PolishTEKST
Portuguese (Brazil)TEXTO
Portuguese (Portugal)TEXTO
RussianТЕКСТ
SpanishTEXTO
TurkishMETNEÇEVİR

Recipes that use TEXT