This article describes the formula syntax and usage of the TEXT function in Microsoft Excel.
Description
The TEXT function converts a numeric value to text and lets you specify the display formatting by using special format strings. This function is useful in situations where you want to display numbers in a more readable format, or you want to combine numbers with text or symbols. For example, suppose cell A1 contains the number 23.5. To format the number as a dollar amount, you can use the following formula:
=TEXT(A1,"$0.00")
In this example, Excel displays $23.50.
You can also format numbers by using the commands in the Number group on the Home tab of the Ribbon. However, these commands work only if the entire cell is numeric. If you want to format a number and combine it with other text, the TEXT function is the best option. For example, you can add text to the preceding formula:
=TEXT(A1,"$0.00") & " per hour"
Excel displays $23.50 per hour.
Syntax
TEXT(value, format_text)
The TEXT function syntax has the following arguments:

value Required. A numeric value, a formula that evaluates to a numeric value, or a reference to a cell containing a numeric value.

format_text Required. A numeric format as a text string enclosed in quotation marks, for example "m/d/yyyy" or "#,##0.00". See the following sections for specific formatting guidelines.
Guidelines for number formats

Display decimal places and significant digits To format fractions or numbers that contain decimal points, include the following digit placeholders, decimal points, and thousand separators in the format_text argument.

Placeholder 
Description 
0 (zero) 
Displays insignificant zeros if a number has fewer digits than there are zeros in the format. For example, if you type 8.9, and you want it to be displayed as 8.90, use the format #.00. 
# 
Follows the same rules as the 0 (zero). However, Excel does not display extra zeros when the number that you type has fewer digits on either side of the decimal than there are # symbols in the format. For example, if the custom format is #.##, and you type 8.9 in the cell, the number 8.9 is displayed. 
? 
Follows the same rules as the 0 (zero). However, Excel adds a space for insignificant zeros on either side of the decimal point so that decimal points are aligned in the column. For example, the custom format 0.0? aligns the decimal points for the numbers 8.9 and 88.99 in a column. 
. (period) 
Displays the decimal point in a number. 

If a number has more digits to the right of the decimal point than there are placeholders in the format, the number rounds to as many decimal places as there are placeholders. If there are more digits to the left of the decimal point than there are placeholders, the extra digits are displayed. If the format contains only number signs (#) to the left of the decimal point, numbers less than 1 begin with a decimal point; for example, .47.
To display 
As 
Use this format 
1234.59 
1234.6 
"####.#" 
8.9 
8.900 
"#.000" 
0.631 
0.6 
"0.#" 
12 
12.0 
"#.0#" 
44.398 
44.398 
"???.???" 
5.25 
5 1/4 
"# ???/???" 

Display a thousands separator To display a comma as a thousands separator or to scale a number by a multiple of 1,000, include the following separator in the number format.
, (comma) 
Displays the thousands separator in a number. Excel separates thousands by commas if the format contains a comma that is enclosed by number signs (#) or by zeros. A comma that follows a digit placeholder scales the number by 1,000. For example, if the format_text argument is "#,###.0,", Excel displays the number 12,200,000 as 12,200.0. 
To display 
As 
Use this format 
12000 
12,000 
"#,###" 
12000 
12 
"#," 
12200000 
12.2 
"0.0,," 
Guidelines for date and time formats

Display days, months, and years To display numbers as date formats (such as days, months, and years), use the following codes in the format_text argument.
m 
Displays the month as a number without a leading zero. 
mm 
Displays the month as a number with a leading zero when appropriate. 
mmm 
Displays the month as an abbreviation (Jan to Dec). 
mmmm 
Displays the month as a full name (January to December). 
mmmmm 
Displays the month as a single letter (J to D). 
d 
Displays the day as a number without a leading zero. 
dd 
Displays the day as a number with a leading zero when appropriate. 
ddd 
Displays the day as an abbreviation (Sun to Sat). 
dddd 
Displays the day as a full name (Sunday to Saturday). 
yy 
Displays the year as a twodigit number. 
yyyy 
Displays the year as a fourdigit number. 
To display 
As 
Use this format 
Months 
1–12 
"m" 
Months 
01–12 
"mm" 
Months 
Jan–Dec 
"mmm" 
Months 
January–December 
"mmmm" 
Months 
J–D 
"mmmmm" 
Days 
1–31 
"d" 
Days 
01–31 
"dd" 
Days 
Sun–Sat 
"ddd" 
Days 
Sunday–Saturday 
"dddd" 
Years 
00–99 
"yy" 
Years 
1900–9999 
"yyyy" 

Display hours, minutes, and seconds To display time formats (such as hours, minutes, and seconds), use the following codes in the format_text argument.
h 
Displays the hour as a number without a leading zero. 
[h] 
Displays elapsed time in hours. If you are working with a formula that returns a time in which the number of hours exceeds 24, use a number format that resembles [h]:mm:ss. 
hh 
Displays the hour as a number with a leading zero when appropriate. If the format contains AM or PM, the hour is shown based on the 12hour clock. Otherwise, the hour is shown based on the 24hour clock. 
m 
Displays the minute as a number without a leading zero. Note: The m or the mm code must appear immediately after the h or hh code or immediately before the ss code; otherwise, Excel displays the month instead of minutes. 
[m] 
Displays elapsed time in minutes. If you are working with a formula that returns a time in which the number of minutes exceeds 60, use a number format that resembles [mm]:ss. 
mm 
Displays the minute as a number with a leading zero when appropriate. Note: The m or the mm code must appear immediately after the h or hh code or immediately before the ss code; otherwise, Excel displays the month instead of minutes. 
s 
Displays the second as a number without a leading zero. 
[s] 
Displays elapsed time in seconds. If you are working with a formula that returns a time in which the number of seconds exceeds 60, use a number format that resembles [ss]. 
ss 
Displays the second as a number with a leading zero when appropriate. If you want to display fractions of a second, use a number format that resembles h:mm:ss.00. 
AM/PM, am/pm, A/P, a/p 
Displays the hour based on a 12hour clock. Excel displays AM, am, A, or a for times from midnight until noon and PM, pm, P, or p for times from noon until midnight. 
To display 
As 
Use this format 
Hours 
0–23 
"h" 
Hours 
00–23 
"hh" 
Minutes 
0–59 
"m" 
Minutes 
00–59 
"mm" 
Seconds 
0–59 
"s" 
Seconds 
00–59 
"ss" 
Time 
4 AM 
"h AM/PM" 
Time 
4:36 PM 
"h:mm AM/PM" 
Time 
4:36:03 P 
"h:mm:ss A/P" 
Time 
4:36:03.75 
"h:mm:ss.00" 
Elapsed time (hours and minutes) 
1:02 
"[h]:mm" 
Elapsed time (minutes and seconds) 
62:16 
"[mm]:ss" 
Elapsed time (seconds and hundredths) 
3735.80 
"[ss].00" 
Guidelines for currency, percentages, and scientific notation format

Include currency symbols To precede a number with a dollar sign ($), type the dollar sign at the beginning of the format_text argument (for example, "$#,##0.00"). To enter one of the following currency symbols in a number format, press NUM LOCK and use the numeric keypad to type the ANSI code for the symbol.
To enter 
Use this key combination 
¢ 
ALT+0162 
£ 
ALT+0163 
¥ 
ALT+0165 

ALT+0128 

Note: You must use the numeric keypad; using the ALT key with the number keys in the top row of the keyboard will not generate ANSI codes.

Display percentages To display numbers as a percentage of 100 — for example, to display .08 as 8% or 2.8 as 280% — include the percent sign (%) in the format_text argument.

Display scientific notations To display numbers in scientific (exponential) format, use the following exponent codes in the format_text argument.
E (E, E+, e, e+) 
Displays a number in scientific (exponential) format. Excel displays a number to the right of the "E" or "e" that corresponds to the number of places that the decimal point was moved. For example, if the format_text argument is "0.00E+00", Excel displays the number 12,200,000 as 1.22E+07. If you change the format_text argument to "#0.0E+0", Excel displays 12.2E+6. 
Guidelines for including text and adding spacing

If you include any of the following characters in the format_text argument, they are displayed exactly as entered.
$ 
Dollar sign 
+ 
Plus sign 
( 
Left parenthesis 
: 
Colon 
^ 
Circumflex accent (caret) 
' 
Apostrophe 
{ 
Left curly bracket 
< 
Lessthan sign 
= 
Equal sign 
 
Minus sign 
/ 
Slash mark 
) 
Right parenthesis 
! 
Exclamation point 
& 
Ampersand 
~ 
Tilde 
} 
Right curly bracket 
> 
Greaterthan sign 
Space character 

The format_text argument cannot contain an asterisk (*).

Using the TEXT function converts a numeric value to formatted text, and the result can no longer be calculated as a number. To format a cell so that its value remains numeric, rightclick the cell, click Format Cells, and then in the Format Cells dialog box, on the Number tab, set the formatting options you want. For more information about using the Format Cells dialog box, click the Help button (?) in the upper right corner of the dialog box.
Example
Copy the example data in the following table, and paste it in cell A1 of a new Excel worksheet. For formulas to show results, select them, press F2, and then press Enter. If you need to, you can adjust the column widths to see all the data.
Salesperson 
Sales 
Data 
Burke 
$2,800 
39300.63 
Dykstra 
40% 

Formula 
Description 
Result 
=A2&" sold "&TEXT(B2, "$0.00")&" worth of units." 
Combines cell A2, the text string " sold," cell B2 (formatted as currency), and the text string " worth of units." into a phrase. 
Burke sold $2800.00 worth of units. 
=A3&" had "&TEXT(B3, "0%")&" of the total sales." 
Combines cell A3, the string " sold," cell B3 (formatted as a percentage), and the text string " of the total sales." into a phrase. 
Dykstra had 40% of the total sales. 
="Date: " & TEXT(C2, "yyyymmdd") 
Displays the value in C2 in a 4digit year, 2digit month, 2digit day format. 
Date: 20070806 
="Datetime: " & TEXT(C2, "m/d/yyyy h:mm AM/PM") 
Displays the value in C2 in a short date, 12hour time format. 
Datetime: 8/6/2007 3:07 PM 
=TEXT(C2, "0.00E+00") 
Displays the value in C2 in scientific (exponential) format. 
3.93E+04 
=TEXT(C2, "$#,##0.00") 
Displays the value in C2 in a currency format, with a thousands separator. 
$39,300.63 