This article explains how to use the TEXT()-function.
The TEXT() function is an extremely powerful utility for number formatting. In essence, the TEXT() function converts a number to its textual representation. However, its capabilities extend way beyond this basic use. The TEXT() function allows you to specify exactly the way a number needs to be formatted by applying format codes.
The syntax for the TEXT() function is as follows:
number: A numerical value
format_string: A sequence of format codes enclosed within two quotation marks
You can format numbers with a combination of the following codes:
# places a digit, if there is no digit to place it places nothing: ''
0 places a digit, if there is no digit to place it places a zero: '0'
? places a digit, if there is no digit to place it places a space: ' '
Moreover, you may also use spaces and or supporting symbols in your format.
The TEXT() function also allows you to format numbers as percentages. This is achieved by adding a percentage symbol (%) in the format.
Another type of number TEXT() supports is fractions. This format allows you to display any decimal number as a fraction. This a special format that needs to be in the following formats: "# ?/?", "# 4/?", "# ?/4".