How to use the TEXT function to format dates and numbers in Excel?

To use the TEXT function in Excel to format dates and numbers, follow these steps:

  1. Open Excel and select the cell where you want to display the formatted result.
  2. Start typing the formula =TEXT( and select the cell or value you want to format.
  3. Enter a comma (,) and specify the format you want to use within double quotation marks ("").
    • For Date formatting, use codes like "dd" for day, "mm" for month, and "yyyy" for year. For example, "dd/mm/yyyy" will display the date as 01/01/2022.
    • For Number formatting, you can use codes like "0" for digit placeholders and "#" for optional digits. For example, "0.00" will display the number as 2 decimal places.
  4. Close the parentheses and press Enter to complete the formula.

Example: Suppose you have a date in cell A1 that you want to display as "January 1, 2022". You can use the TEXT function as follows: =TEXT(A1, "mmmm d, yyyy")

Suppose you have a number in cell B1 that you want to display with 2 decimal places. You can use the TEXT function as follows: =TEXT(B1, "0.00")

The result will be displayed based on the formatting you provided within the TEXT function.