TEXT Function in Excel
Master the TEXT function to format numbers, dates, and values as text with custom formats. Learn syntax, examples, and solutions to common formatting issues.




=TEXT(value, format_text)
Practical Examples
Financial Report Formatting
Format sales figures with currency and thousands separators for quarterly reports
Date Formatting for Invoices
Convert dates to custom format for professional invoices
Product Code with Leading Zeros
Maintain leading zeros in product codes and ZIP codes
Percentage Display with Custom Text
Format growth rates and percentages for dashboards
Time Duration Formatting
Display time durations in hours and minutes for project tracking
Phone Number Formatting
Format phone numbers consistently from numeric input
Scientific Notation for Large Numbers
Display large numbers in scientific notation for technical reports
Common Errors and Solutions
TEXT formula returns #VALUE! error
The format_text parameter is not a valid format string or contains syntax errors
1. Check that format codes are enclosed in quotes 2. Verify format codes are valid (e.g., 'mm' not 'mn' for months) 3. Ensure special characters are properly escaped 4. Use double quotes around the entire format string 5. Test with a simple format first like "0.00"
Always enclose format strings in double quotes and refer to format code documentation
Example:
Dates showing as numbers like 45562 instead of formatted date
The value parameter is not recognized as a valid date or the date serial number isn't being interpreted correctly
1. Ensure the source cell contains a proper date value 2. Use DATE function to create valid dates first 3. Check if the date is stored as text and convert using DATEVALUE 4. Verify regional date settings match your data 5. Try =TEXT(DATEVALUE(A2), "mm/dd/yyyy") for text dates
Always verify source data is in proper date format before applying TEXT function
Example:
Numbers rounded unexpectedly or losing decimal places
The format string doesn't include enough decimal places or uses rounding format codes
1. Add more decimal places to format: "0.0000" instead of "0.00" 2. Use # for optional digits: "#,##0.###" 3. Check source data precision isn't already limited 4. Avoid percentage formats if you need exact decimals 5. Consider if TEXT is needed or if VALUE would preserve precision
Match format decimal places to your data's precision requirements
Example:
Format codes not working as expected in different regional settings
Format codes vary by system locale - comma vs period for decimals, date order differences
1. Use locale-neutral formats when sharing internationally 2. Test with DOLLAR vs EURO functions for currency 3. Use ISO date format "yyyy-mm-dd" for consistency 4. Document regional assumptions in your spreadsheet 5. Consider using separate format strings for different regions
Develop templates with region-specific format variants
Example:
Best Practices and Advanced Techniques
Store format codes in cells and reference them dynamically for flexible formatting. Create a format library in a hidden sheet with named ranges like 'CurrencyFormat' or 'DateFormat'. This allows updating all formulas by changing one cell.
Use TEXT within CONCATENATE or CONCAT functions to build complex strings with mixed formatting. This is perfect for creating narrative reports or email templates with embedded formatted values.
Remember that TEXT always returns a text string, not a number. You cannot perform calculations on TEXT results without converting back using VALUE. Plan your formula sequence accordingly.
Always wrap TEXT in IFERROR when dealing with potentially invalid data to prevent formula errors from cascading through your spreadsheet.
Use semicolons in format strings to apply different formats based on positive, negative, zero, or text values. Format pattern: positive;negative;zero;text
For large datasets, consider whether formatting is needed in the formula or if cell formatting would be more efficient. TEXT adds processing overhead compared to native number formatting.
Use 'dddd' for full day names (Monday) and 'mmmm' for full month names (September). Use 'ddd' and 'mmm' for abbreviated versions (Mon, Sep).
Need Help with TEXT Function in Excel?
Stop struggling with formula syntax. Use AskFormulas to generate validated formulas instantly with our AI-powered tool.
Example Excel formula:
Related Formulas
Master the CONCAT function to combine text from multiple cells efficiently. Learn syntax, examples, and solutions to common errors in Excel and Google Sheets.

Master CONCATENATE to join text in Excel and Google Sheets. Learn syntax, examples, errors, and modern alternatives like CONCAT and TEXTJOIN.

Master VALUE to convert text to numbers in Excel & Google Sheets. Learn syntax, examples, error fixes, and best practices for data conversion.

Master the FIND function to locate text within strings. Learn syntax, handle #VALUE! errors, and explore 7 practical examples for text extraction.
