TEXT Function


In Microsoft Excel, the TEXT function is used to convert a value to text in a specific number format. The syntax for the TEXT function is as follows:

Syntax

=TEXT(value, format_text)

  • value: This is the numeric value that you want to convert to text.
  • format_text: This is the format you want to apply to the value. It could be a predefined number format or a custom format.

Example

=TEXT(A1, "mm/dd/yyyy")

In this example, if the date in cell A1 is, for instance, 2023-08-06, the formula would convert it to text in the format "08/06/2023".

Formula



Output



Here are a few more examples of how you can use the TEXT function:

Number formatting:


=TEXT(A1, "#,##0.00")

This would format the number in A1 with commas as thousand separators and two decimal places.

Formula



Output



Date formatting:


=TEXT(A1, "dddd, mmmm d, yyyy")

Formula



This would display the date in the format "Sunday, August 6, 2023".

Output



Custom text formatting:


=TEXT(A1, "0%")

If A1 contains the number 0.25, this formula would display "25%".

Formula



Output



Remember to adjust the format_text argument based on the formatting you want to apply to your specific data. Excel provides a variety of built-in date and number formats, and you can also create custom formats using a combination of characters.