Example 1
Show a number with thousands separators and two decimals
C2 =TEXT(B2,"#,##0.00")
Result: 1,234.50
The result is the text 1,234.50. The cell B2 itself is still the number 1234.5.
C2 =TEXT(B2,"#,##0.00") returns 1,234.50
Converts a number or date to text in the format you specify, such as 1,234.50, 26% or 15-Mar-2025.
Syntax
=TEXT(, )
All versions of Excel.
Try it
Edit the formula in C2 or change the inputs. The sheet recalculates as you type.
C2 =TEXT(B2,"#,##0.00") returns 1,234.50
TEXT converts a number, date or time into text, formatted as you specify. Use it when a formatted value has to sit inside a sentence, a label or a joined code. Formatting a cell with a number format changes only how the cell looks. TEXT changes the actual text that other formulas see.
=TEXT(1234.5,"#,##0.00") returns the text 1,234.50. =TEXT(0.256,"0.0%") returns 25.6%. Dates work the same way: =TEXT(B2,"dd-mmm-yyyy") turns the serial number 45731 into 15-Mar-2025.
Numbers
| Code | Result for 1234.567 | |---|---| | 0 | 1235 | | 0.00 | 1234.57 | | #,##0 | 1,235 | | #,##0.00 | 1,234.57 | | $#,##0.00 | $1,234.57 |
0 always shows a digit, with a zero if there isn't one, so TEXT(7,"000") gives 007. # shows a digit only if there is one. A percent sign multiplies the value by 100, so TEXT(0.256,"0%") gives 26%.
Negative numbers. A format can have up to four sections separated by semicolons: positive, negative, zero and text. TEXT(-5,"0.00;(0.00)") returns (5.00).
Dates (shown for 15 March 2025)
| Code | Result | |---|---| | d mmmm yyyy | 15 March 2025 | | dd-mmm-yyyy | 15-Mar-2025 | | yyyy-mm-dd | 2025-03-15 | | mmm yyyy | Mar 2025 | | mmmm | March | | dddd | Saturday |
Times. TEXT(0.75,"h:mm AM/PM") returns 6:00 PM, because 0.75 of a day is 18:00.
The result looks like a number but is text, so it can't be summed or compared as a number. Keep the original value for calculations and use TEXT only where the result is displayed. If you must convert it back, use VALUE.
The usual job is building a sentence: ="Revenue was "&TEXT(B2,"$#,##0")&" ("&TEXT(C2,"0.0%")&" of target)". Without TEXT, Excel would join the raw numbers and you would see 0.256 and 1234.5.
It is also how you add leading zeros to a number that must keep a fixed width, such as =TEXT(A2,"000000"), and how you turn a date into a month label that sorts as text.
Format codes are read using your Excel language settings. In some language versions the date letters differ, for example German Excel uses TT.MM.JJJJ instead of dd.mm.yyyy, and the decimal and thousands separators follow your region. A workbook that uses TEXT with date codes can show a different result, or an error, when opened on a computer set to another language.
The code m means month, unless it comes straight after h or before s, where it means minutes. TEXT(0.75,"h:mm") returns 18:00, with mm as minutes.
B2 or a calculation. If it is text that looks like a number, Excel converts it first. Other text is returned unchanged."#,##0.00", "0%" or "dd-mmm-yyyy". It uses the same codes as the Custom category in Format Cells.Each example is a live sheet. Change the inputs or the formula and watch the result.
Example 1
C2 =TEXT(B2,"#,##0.00")
Result: 1,234.50
The result is the text 1,234.50. The cell B2 itself is still the number 1234.5.
C2 =TEXT(B2,"#,##0.00") returns 1,234.50
Example 2
C2 =A2&" delivered "&TEXT(B2,"0.0%")&" of sales"
Result: North delivered 25.6% of sales
Without TEXT, the sentence would end in "0.256 of sales".
C2 =A2&" delivered "&TEXT(B2,"0.0%")&" of sales" returns North delivered 25.6% of sales
Example 3
C2 ="Due "&TEXT(B2,"dddd, d mmmm yyyy")
Result: Due Saturday, 15 March 2025
The serial number 45731 is 15 March 2025, which fell on a Saturday. "dddd" is the full weekday name.
C2 ="Due "&TEXT(B2,"dddd, d mmmm yyyy") returns Due Saturday, 15 March 2025
Example 4
C2 =TEXT(A2,"000000")
Result: 000412
Each 0 in the code forces a digit, so 412 is padded to six characters. The result is text.
C2 =TEXT(A2,"000000") returns 000412
Example 5
C2 =TEXT(B2,"#,##0.00;(#,##0.00)")
Result: (1,250.50)
The second section, after the semicolon, applies to negative numbers. The minus sign is not shown because the section has none.
C2 =TEXT(B2,"#,##0.00;(#,##0.00)") returns (1,250.50)
Solve it in the sheet. Every answer is checked, with hints if you need them.
Task 1 of 2
In C2, show the amount in B2 as text with a dollar sign, thousands separators and two decimals, like $1,234.50. Fill it down to C5.
Answer in C2, then it fills down to C5.
=TEXT(B2,"0.00"). Without the quotes, 0.00 is just the number 0, and the two decimals you meant are lost.mm after an hour is minutes, but otherwise it is months. TEXT(B2,"mm") gives the month number, and TEXT(B2,"h:mm") gives minutes.$ in the format code is a literal dollar sign in any region. For another currency, put its symbol in the code, such as "€#,##0.00".=TEXT("abc","0.00") returns "abc", with no error to warn you.Use TEXT with a format code in quotes: `=TEXT(A2,"#,##0.00")` for thousands separators and two decimals, or `=TEXT(A2,"0%")` for a percentage.
Wrap the date in TEXT: `="Due "&TEXT(B2,"dd-mmm-yyyy")`. Without it, Excel joins the date's serial number, such as 45731.
Use `=TEXT(A2,"000000")` for six digits. The result is text. If the number is already text, such as an ID with the leading zeros stripped, `=REPT("0",6-LEN(A2))&A2` also works.
Format codes follow the language and regional settings of the Excel that opens the file. Date and time letters differ between languages, so avoid date codes in files shared across regions, or test them on the target version.
Cell formatting changes only how a value is displayed. The underlying number is unchanged. TEXT creates a new text value, which is what other formulas, joins and exports see.
TEXT is taught in Logic and text, lesson 17: TEXT for formatting. Each lesson is a short, graded exercise like the one above.