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.

ExcelExcel
Google SheetsGoogle Sheets
text
intermediate
Syntax Preview
ExcelExcelGoogle SheetsGoogle Sheets
=TEXT(value, format_text)
Quick Answer
Comprehensive Explanation
Format Codes Guide

Practical Examples

Financial Report Formatting

Format sales figures with currency and thousands separators for quarterly reports

Result: $125,750.50

Date Formatting for Invoices

Convert dates to custom format for professional invoices

Result: September 27, 2025

Product Code with Leading Zeros

Maintain leading zeros in product codes and ZIP codes

Result: 07890

Percentage Display with Custom Text

Format growth rates and percentages for dashboards

Result: 15.7%

Time Duration Formatting

Display time durations in hours and minutes for project tracking

Result: 2:45

Phone Number Formatting

Format phone numbers consistently from numeric input

Result: (202) 555-1234

Scientific Notation for Large Numbers

Display large numbers in scientific notation for technical reports

Result: 1.23E+09

Common Errors and Solutions

#VALUE!

TEXT formula returns #VALUE! error

Cause:

The format_text parameter is not a valid format string or contains syntax errors

Solution:

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"

Prevention:

Always enclose format strings in double quotes and refer to format code documentation

Frequency: 35%

Example:

Wrong Date Display

Dates showing as numbers like 45562 instead of formatted date

Cause:

The value parameter is not recognized as a valid date or the date serial number isn't being interpreted correctly

Solution:

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

Prevention:

Always verify source data is in proper date format before applying TEXT function

Frequency: 28%

Example:

Lost Precision

Numbers rounded unexpectedly or losing decimal places

Cause:

The format string doesn't include enough decimal places or uses rounding format codes

Solution:

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

Prevention:

Match format decimal places to your data's precision requirements

Frequency: 20%

Example:

Regional Format Issues

Format codes not working as expected in different regional settings

Cause:

Format codes vary by system locale - comma vs period for decimals, date order differences

Solution:

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

Prevention:

Develop templates with region-specific format variants

Frequency: 17%

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).

TEXT vs Alternative Functions
Frequently Asked Questions

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

CONCAT Function in Excel

Master the CONCAT function to combine text from multiple cells efficiently. Learn syntax, examples, and solutions to common errors in Excel and Google Sheets.

beginner
text
ExcelExcel
Validated
CONCATENATE Function

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

beginner
text
ExcelExcel
Validated
VALUE Function in Excel

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

beginner
text
ExcelExcel
Validated
FIND Function in Excel

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

intermediate
text
ExcelExcel
Validated