TEXT Function Examples
TEXT Function Examples
The following worksheets have various TEXT function examples as mentioned in the followi
Each worksheet is listed below, along with what kind of examples you'll find, and each shee
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
ction Examples
s have various TEXT function examples as mentioned in the following Support.Office.com article:
below, 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
m article:
ed to the sheet.
Excel Format Codes from the Format Cells dialog
Format Code
General
Number
Currency
Accounting
Date
Time
Percentage
Fraction
Scientific
Text
Special
Custom
Description
No specific number format
General number display with or without thousand separators and decimals
Currency formats are used for general monetary values
Accounting formats line up the currency symbols and decimal points in a column
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 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 formats multiply the cell value by 100 and displays the results with a
percent symbol (%).
Fraction formats display numbers as fractions rather than decimals.
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 format cells are treated as text even when a number is in the cell.
The cell is displayed exactly as entered.
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
Create your own format code, using one of the existing codes as a starting point
12.30%
1 3/4
1.23E+08
1234
12345
12345-1234
(123) 456-7899
123-45-6789
N/A
Use Ctrl+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
4/26/2017 =TEXT(A9,"MM/DD/YY") 04/26/17
4/26/2017 =TEXT(A10,"DDDD") Wednesday
0.285 =TEXT(A11,"0.00%") 28.50%
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 use the number format that you
Package Delivered at: 03:30 PM want.
Weekly Revenue: $66,348.72
rce Excel
hat you
Thousands separator
Value Description
1234.56 Number - General
1234.56 Number - thousands separator,
1234.56 no decimals
Number - thousands separator,
2 decimals
1234.56 Currency - no decimals
1234.56 Currency - 2 decimals
-1234.56 Currency - 2 decimals,
1234.56 negative value
Accounting - no decimals
1234.56 Accounting - 2 decimals
Cell formatting with negative value in red - the TEXT function doesn't support color format
($1,235) Currency with a negative value formated as $#,##0._);[Red]($#,##0.) from the Format Cel
Date: 4/26/2017
You could also use a Named Range instead of a cell value, where cell B3 has been named "
Formula Result
=TEXT(StartDate,"m")4
=TEXT(B3,"M")
=TEXT("3/12/14","m")
Elapsed Time
3735.80 "[ss].00" =TEXT(B18,"[ss].00")
(seconds & hundredths)
1:02
62:16
3735.80
Combine Date & Time formats
Current Date/Time:
Formula
="Date: "&TEXT(B3,"mm/dd/yyyy")
="Date-time: " & TEXT(B3, "m/d/yyyy h:mm AM/PM")
Full sentence
Today is Wednesday, April 2017, and the current time is 12/28 AM.
="Today is "&TEXT(B3,"dddd, mmmm yyyy")&", and the current time is "&TEXT(B3,"hh/mm AM/PM")&
Result
Date: 04/26/2017 Combine Dates & Times You can easily
Date-time: 4/26/2017 12:28 AM combine date and time format strings, like:
the current time is "&TEXT(B3,"hh/mm AM/PM")&"." ="Today is "&TEXT(B3,"dddd, mmmm yyyy")&", and
the current time is "&TEXT(B3,"hh/mm AM/PM")&"."
ou can easily
strings, like:
M/PM")
** Note the second example uses the TRIM function to trim the
leading space from decimal only values.
Scientific notation formats
Value Description
12345 Zip Code
123456789 Zip Code + 4
1234567899 Phone Number
123456789 Social Security Number
ction reference
You can create your own Special fomats with a Custom
number format. For example, a standard 16-digit credit
card format could be:
"####-####-####-####"
Using Symbols with the TEXT function to create custom format
Formula
=D4&" sold "&TEXT(E4,"$#,###")&" worth of units.
=D4&" had "&TEXT(F4, "0%")&" of total sales."
TEXT w/a
Formula Line Break
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
e Setup
or Time
3. Add your section text and click on the Date or Time buttons above
Date/Tim
e
selections
Report Time: 00:28:43 Report Date: 04/26/2017
Report Time: 00:28:43 Report Date: 04/26/2017
me buttons above
Date/Tim
e
selections
Report Time: 00:28:43 Report Date: 04/26/2017