If you want to use numbers or dates in a text in Excel, sometimes a simple cell reference is not enough because the number or date is not displayed in the text format that you need. In these cases, the Excel TEXT function comes in handy. It allows you to convert any data (e.g. numbers, dates, etc.) into text and format it as you wish.

Excel with Microsoft 365 Business and IONOS!
The Office you know, only better
  • Up to 50 GB Exchange email account
  • Outlook Web App and col­lab­or­a­tion tools
  • Expert support & setup service
Tip

The following in­struc­tions apply to Microsoft 365 and Excel versions 2021, 2019 and 2016.

What is the Excel TEXT() function?

The TEXT() function is written as follows:

=TEXT(Value,format_text)

The Excel TEXT function requires two para­met­ers:

  • Value: enter the data to be displayed as text, either as a direct entry or as a reference to the cell con­tain­ing the data.
  • Format_text: tell Excel how you want to format the number.

If you don’t need special format­ting, you can simply enter a hashtag as part of the text format code, as shown in the following example:

=TEXT(88;"#")

The hashtag (‘#’) is one of three place­hold­er char­ac­ters that you can use to write format codes. We’ll go over these codes in more detail below.

Image: Screenshot with different application examples of the Excel TEXT function
The TEXT function allows you to format numbers as you wish.
Note

In cells, text is aligned to the left, while numbers are aligned to the right.

What are Excel Text format codes?

The Excel TEXT() function requires a format code. There are three different place­hold­ers available for this purpose. Each rep­res­ents one digit of the numerical value:

PlaceĀ­holdĀ­er Function
# Optional digit: ignored if the number contains fewer digits than the number of placeĀ­holdĀ­er charĀ­acĀ­ters.
0 Zero placeĀ­holdĀ­er: if no digit is available for this position, Excel will write a zero.
? Space placeĀ­holdĀ­er: only works with fracĀ­tionĀ­al numbers. Excel fills missing digits with spaces so that fracĀ­tionĀ­al numbers can be aligned with the decimal point or the fraction bar.

You use these place­hold­ers in com­bin­a­tion with certain text char­ac­ters. For example, you can display numbers with leading zeros, in­di­vidu­al thousands sep­ar­at­ors, telephone numbers or units of meas­ure­ment:

Use case Numerical value Format code Text displayed
Fixed number of digits 123 ā€œ000000ā€ 000123
Thousands sepĀ­arĀ­atĀ­ors 21350 ā€œ##’###ā€ 21’350
Telephone number 8001234567 ā€œ0### ### ####ā€ 0800 123 4567
Unit of measĀ­ureĀ­ment (e.g. degree) 90 ā€œ#Ā°ā€ 90°

However, you can only use certain text char­ac­ters directly in the format codes:

CharĀ­acĀ­ters DeĀ­scripĀ­tion
+ - Plus, minus
() {} Brackets and curly brackets
$ € Currency symbols
. , : ! PuncĀ­tuĀ­ation: period, comma, colon, exĀ­clamĀ­aĀ­tion mark
^ ’ ~ Caret, apoĀ­strophe, tilde
Space
/ Forward slash
= Equals sign

In the next section, you can find out how to insert text into a format code.

Tip

With IONOS HiDrive cloud storage, you can store, edit and share your Office documents centrally and securely. Whether privately or pro­fes­sion­ally, you can work flexibly from any device with the HiDrive app and other in­ter­faces. Your data is optimally protected in IONOS state-of-the-art data centres.

How to add text to numbers

If you want to insert text char­ac­ters that Excel doesn’t recognise, you have to enter a backslash (\) before the text character. This backslash – referred to as an ‘escape character’ – tells Excel to treat the following character as plain text and not as a symbol.

For example, if you want to add the word ‘meter’ after the number ‘100’ so that Excel outputs ‘100 meter’, you can do so with the following code:

=TEXT(100;"# \m\e\t\er")

You can also get Excel to write a number as a per­cent­age without mul­tiply­ing it by 100. For example, if you want to format the number 33 as ‘33%’, you can use the following code.

=TEXT(33;"###\%")

If you find the use of escape char­ac­ters too cum­ber­some, there are two al­tern­at­ives:

  • Direct format­ting: you can format the numerical value directly. In the Format Cells – Custom dialog box, you can integrate any text without using the escape character. In this dialog box, you can also find other format codes that cannot be used in the TEXT() function.
  • Con­cat­en­at­ing text: you can con­cat­en­ate text to add ad­di­tion­al text. To do so, you need to use the ‘&’ symbol. For example, if you want Excel to display ‘100 meter’, you would use the following code:
=TEXT(100;"#") & "meter"

What special control char­ac­ters are there for format codes?

In addition to place­hold­ers, there are a number of other control char­ac­ters available for format­ting text:

Function Control charĀ­acĀ­ters Effect
Write as a fraction / If you insert a forward slash, Excel will convert the number to a fraction. You can also define the deĀ­nomĀ­inĀ­atĀ­or that Excel should use to convert the number. For example, the number 40 could be written as ā€˜200/5’.
Format as a perĀ­centĀ­age % MulĀ­tiĀ­plies a number by 100 and adds a perĀ­centĀ­age sign after it. For example, the number 0.6 becomes ā€˜60%’.
ConĀ­diĀ­tionĀ­al formatĀ­ting [>=1000] In square brackets, you can specify a condition that must be met for Excel to apply the formatĀ­ting. If the condition is not met, Excel converts the number as if you had only entered the format code ā€˜#’.
Tip

You can force Excel to treat cell entries as text by writing an apo­strophe () as the first character. The apo­strophe itself will not be visible in the cell.

Which functions can be combined with Excel TEXT?

You can add more Excel functions to the TEXT() function or replace it partially with the following functions:

Function DeĀ­scripĀ­tion Example
=DOLLAR() Writes a number using the currency format =DOLLAR(40) outputs ā€˜$40.00’
=FIXED() Writes the number using a fixed number of decimal places =FIXED(12.34,4) outputs ā€˜12.3400’
=TRIM() Deletes spaces before/after the text =TRIM(ā€œ33ā€) outputs ā€˜33’
=UPPER () CapĀ­itĀ­alĀ­ises all letters in the text =UPPER(ā€œexcelā€) outputs ā€˜EXCEL’
=PROPER() CapĀ­itĀ­alĀ­ises the first letter and leaves the rest in lowercase letters =PROPER(ā€œexcelā€) outputs ā€˜Excel’
=ROUND() Rounds a number to a fixed number of decimal places =ROUND(12.445,1) results in ā€˜12.4’

In addition to the functions mentioned above, Excel also offers numerous helpful functions that make working with the popular program much easier. In the following articles, we take a look at other functions in Excel and provide examples for how to use them.

Function ApĀ­plicĀ­aĀ­tion
Excel WORKDAY Determine the number of working days in a specified period of time.
Excel XMATCH Finds an element in a row or column and returns the relative position.
Excel OR Compares a Boolean OR.
Excel SEARCH Searches for a specific string in a specified search range.
Microsoft 365 Business
The Office you know, only better
  • Up to 50 GB Exchange email account
  • Outlook Web App and col­lab­or­a­tion tools
  • Expert support & setup service
Go to Main Menu