TEXT Function Examples
TEXT Function Examples
The following worksheets have various TEXT function examples as mentioned in the following Support.Office.c
Each worksheet is listed below, along with what kind of examples you'll find, and each sheet name is hyperlinke
Worksheet
Format Codes
TEXT() function intro
Thousands separator
Number, currency, accounting
Months, days, years
Hours, minutes, seconds
Date & time
Percentage
Fraction
Scientific notation
Special
Symbols
Combine multiple formats
Custom
Leading 0's
New line
Page Header & Footer
unction Examples
have various TEXT function examples as mentioned in the following Support.Office.com article:
elow, along with what kind of examples you'll find, and each sheet name is hyperlinked to the sheet.
Description
List of the format codes from the Format Cells dialog
TEXT function overview and examples
Using the Thousands separator with the TEXT function
Applying number, currency and accounting formats with the TEXT function
Applying months, days and year formats with the TEXT function
Applying hours, minutes and second formats with the TEXT function
Applying date & and time formats with the TEXT function
Applying percentage formats with the TEXT function
Applying fraction formats with the TEXT function
Applying Scientific notation formats with the TEXT function
Applying Special formats with the TEXT function
Using symbols and custom formats with the TEXT function
Combining multiple text and value formats with the TEXT function
Creating and applying Custom formats with the TEXT function
Applying leading 0's with the TEXT function and convert text to numbers
Applying new lines with CHAR(10) and the TEXT function
Adding dates and times to a Page Header or Footer
Excel Format Codes from the Format Cells dialog
Format Code Description
General No specific number format
Number General number display with or without thousand separators and decimals
Currency Currency formats are used for general monetary values
Accounting Accounting formats line up the currency symbols and decimal points in a column
Date Date formats display date and time serial numbers as date values. Date formats that
begin with an asterisk (*) respond to changes in regional date and time settings that are
specified for the operating system. Formats without an asterisk are not affected by
operating system settings.
Time Time formats display date and time serial numbers as date values. Time formats that
begin with an asterisk (*) respond to changes in regional date and time settings that are
specific for the operating system. Formats without an asterisk are not affected by
operating system settings.
Percentage Percentage formats multiply the cell value by 100 and displays the results with a percent
symbol (%).
Fraction Fraction formats display numbers as fractions rather than decimals.
Scientific The Scientific format displays a number in exponential notation, replacing part of the
number with E+ n, where E (which stands for Exponent) multiplies the preceding
number by 10 to the n th power. For example, a 2-decimal Scientific format displays
12345678901 as 1.23E+10, which is 1.23 times 10 to the 10th power.
Text Text format cells are treated as text even when a number is in the cell.
The cell is displayed exactly as entered.
Special Special formats are useful for tracking list and database values. The following special
formats are included:
• Zip Code
• Zip Code + 4
• Phone Number
• Social Security Number
Custom Create your own format code, using one of the existing codes as a starting point
12:16:56 PM
12.30%
1 3/4
1.23E+08
1234
12345
12345-1234
(123) 456-7899
123-45-6789
N/A
1 to launch the Format Cells dialog
TEXT function
• The TEXT function lets you convert a number into a text string.
Basic examples
Value Formula Result
10/13/2019 =TEXT(A9,"MM/DD/YY") 10/13/19
10/13/2019 =TEXT(A10,"DDDD") Sunday
0.285 =TEXT(A11,"0.00%") 029%
Result
Report Printed on: 40982
Package Delivered at: 0,645833333333333
Weekly Revenue: 66348,72
Result
Report Printed on: 03/14/12 Use the TEXT function to force Excel to
Package Delivered at: 03:30 p.m. use the number format that you want.
Weekly Revenue: $66348,72
Excel to
u want.
Thousands separator
Value Formula Result • Excel separates thousands by commas if the for
comma (,) that is enclosed by number signs (#) or
12200000 =TEXT(A4,"#,###") 12200000,
12200000 =TEXT(A5,"0,000.00") 12200000,00000 • A comma that follows a digit placeholder scales
1,000. For example, if the format_text argument
12200000 =TEXT(A6,"#,") 12200000, displays the number 12,200,000 as 12,200.0.
12200000 =TEXT(A7,"#,###.0,") 12200000,0,
12200000 =TEXT(A8,"0.0,,") 12.200.000,,
Cell formatting with negative value in red - the TEXT function doesn't support color formatting
($1,235) Currency with a negative value formated as $#,##0._);[Red]($#,##0.) from the Format Cells dialog
Date: 10/13/2019
You could also use a Named Range instead of a cell value, where cell B3 has been named "StartDate".
Formula Result
=TEXT(StartDate,"m") 10
• =TEXT(B3,"M")
But you could enter the date directly in the formula as long as
you surround it in quotes, like:
• =TEXT("3/12/14","m")
amed "StartDate".
Time formats - Hours, minutes and seconds
Current time: 12:16 PM
Elapsed Time
3735.80 "[ss].00" =TEXT(B18,"[ss].00") 3735.80
(seconds & hundredths)
24-hour clock
• If you leave off the AM/PM, Excel will display the time based
on a 24-hour clock, like 17:30.
Combine Date & Time formats
Current Date/Time: 10/13/2019 12:16 PM
Formula Result
="Date: "&TEXT(B3,"mm/dd/yyyy") Date: 10/13/2019
="Date-time: " & TEXT(B3, "m/d/yyyy h:mm AM/PM") Date-time: 10/13/2019 12:16 PM
Full sentence
Today is Sunday, October 2019, and the current time is 12/16 PM.
="Today is "&TEXT(B3,"dddd, mmmm yyyy")&", and the current time is "&TEXT(B3,"hh/mm AM/PM")&"."
ld display "~$1,235".
You can combine multiple values and text with the Ampersand (&) and
punctuation separators, like &", "& to add a comma followed by a
space. This is called "concatenation".
00001 back to 1
TEXT w/a
Formula Line Break
Today is:
="Today is: "&CHAR(10)&TEXT(TODAY(),"mm/dd/yy")
10/13/19
You can use CHAR(10) with the TEXT function to create a new line, but
you need to format the cell to Wrap Text.
Format Cells (Ctrl+1) > Alignment > Check the Wrap Text check box
Page Header/Footer
You don't need to use the TEXT function to add a Page Header or Footer.
1. To add a Date/Time stamp to a Page Header/Footer first click the Page Setup flyout in the
Ribbon: Pasgfsadfage Layout > Page Setup > Flyout.
3. Add your text in the Left/Center/Right section(s), then click the Date or Time buttons.
1. Choose the Page Setup flyout in the Page Layout ribbon tab
3. Add your section text and click on the Date or Time buttons above
Date/Time
selections
Report Time: 12:16:56 Report Date: 10/13/2019