The Excel TEXT function converts a supplied value into text, in a userspecified format.
The format of the function is :
Where the function arguments are:
value    A numeric value, that you want to be converted into text 
format_text    A text string that defines the formatting that you want to be applied to the supplied value 
The format definitions that can be used in the Excel Text function are shown in the table below. These definitions have the same meaning when used in the custom style of Excel Cell Formatting.
0    Forces the display of a digit in its place 
#    Display digit if it adds to the accuracy of the number (but don't display if a leading zero or a zero at the end of a decimal) 
.    Defines the position that the decimal place takes 
d   

m   

y   

h   

m   

s   

AM/PM    Indicates that a time should be represented using a 12hour clock, followed by "AM" or "PM" 
Because an Excel date is stored as a simple number in Excel, if you attempt to join a name and date into a text string by just using the simple & operator, this will be displayed as a name followed by a number.
For example, if used in cell C2 of the spreadsheet below, the formula:
gives the following result:
One of my most common uses of the Excel Text function is to insert dates into text strings.
Without the use of the Text function, the simple concatenation of a text string with a date gives an unexpected result (see right).
The spreadsheet below shows the Excel Text function used to produce the required merged text string.
As shown in the formula bar, the formula used is:
The examples below show use the Text function, with a variety of specified formats. The spreadsheet on the left shows the function formats and the spreadsheet on the right shows the results.
Formulas:

Results:

Note that the results of the Text function, in column B of the spreadsheet above, are all text values, rather than numeric values.
Further information and examples of the Excel Text function can be found on the Microsoft Office website.
Some users have problems when the Excel Text function returns the #NAME? error:
#NAME?   
This is returned from the Excel Text function, if you omit the quotation marks from around the format_text For example, the formula
=TEXT( A2, dd/mm/yyyy )
will return the #NAME? error. Solution: Add quotes around the formatting definition. Eg. the above example would be corrected as:
=TEXT( A2, "dd/mm/yyyy" )
