Complete Guide to the TEXT Formula in Excel: Format Any Value Professionally
=TEXT(value, format_text)The TEXT formula is one of Excel's most versatile text manipulation functions, enabling users to convert numeric values into formatted text strings with custom formatting. Whether you're working with dates, currency, percentages, or time values, TEXT provides precise control over how data displays in your spreadsheets. This formula is particularly valuable for creating professional reports, generating formatted output for external systems, or preparing data for presentation purposes. Understanding the TEXT function transforms your ability to manage data presentation across Excel versions from 2007 through 365. Unlike simple cell formatting, which only affects display properties, the TEXT formula actually converts values into text strings with your specified format codes embedded. This distinction becomes critical when you need to export data, combine formatted values with other text, or ensure consistent formatting across different systems. The formula's power lies in its flexibility—supporting hundreds of custom format codes for virtually any formatting requirement your business might encounter.
Syntax & Parameters
The TEXT formula follows a straightforward two-parameter structure: =TEXT(value, format_text). The first parameter, 'value', accepts any numeric expression, date, time, or number that requires formatting transformation. This can be a cell reference, calculated result, or literal number. The second parameter, 'format_text', is a text string containing Excel's custom format codes that define how the value should appear. These format codes use specific characters: 'd' for days, 'm' for months, 'y' for years, '0' for digits with leading zeros, '#' for optional digits, and special symbols like '$' for currency or '%' for percentages. For example, =TEXT(12345, "$#,##0.00") converts the number 12345 into formatted currency text "$12,345.00". Understanding format code combinations is essential—"mm/dd/yyyy" formats dates differently than "dd/mm/yyyy", and "0.00" displays decimals while "#.##" suppresses unnecessary zeros. The formula always returns text, never a number, which is important when performing subsequent calculations.
valueformat_textPractical Examples
Formatting Invoice Amounts as Currency
=TEXT(15750.5, "$#,##0.00")This formula converts the numeric value 15750.5 into properly formatted currency text. The format code uses '$' for the currency symbol, '#,##0' to add thousand separators, and '.00' to display exactly two decimal places for cents.
Converting Dates to Readable Format
=TEXT(44562, "dddd, mmmm dd, yyyy")This formula transforms the date serial number 44562 into a fully spelled-out date format. The 'dddd' displays the complete day name, 'mmmm' shows the full month name, 'dd' provides the day with leading zero, and 'yyyy' displays the four-digit year.
Formatting Percentages with Custom Decimals
=TEXT(0.8567, "0.0%")This formula converts the decimal value 0.8567 into percentage format with one decimal place. The '0.0' ensures one decimal position displays, and '%' appends the percentage symbol automatically. Excel multiplies the decimal by 100 internally.
Key Takeaways
- TEXT converts numeric values into formatted text strings using custom format codes, providing precise control over display formatting
- Unlike cell formatting, TEXT results are actual text values that persist when exported and can be concatenated with other text
- Format codes follow specific patterns: 'dd/mm/yyyy' for dates, '$#,##0.00' for currency, '0%' for percentages, 'hh:mm:ss' for time
- TEXT always returns text, never numeric values, so maintain original numeric columns when calculations or sorting are required
- Combine TEXT with CONCATENATE, IF, and VLOOKUP for powerful data presentation in reports, dashboards, and professional documents
Pro Tips
Use TEXT in conjunction with data validation to ensure consistent date formats across team-shared spreadsheets. Create a helper column with =TEXT(DateColumn, "mm/dd/yyyy") to standardize dates regardless of how users enter them.
Impact : Eliminates date format confusion in collaborative workbooks and reduces errors when consolidating data from multiple sources.
Remember that TEXT returns text, so if you need to sort or calculate with formatted values, keep the original numeric column and use TEXT only in display/report columns. Use conditional formatting on the numeric column for visual consistency.
Impact : Maintains data integrity and calculation accuracy while preserving professional appearance in reports and dashboards.
Leverage custom format codes with brackets for conditional display: =TEXT(value, "[>1000]$#,##0;$#,##0") displays values over 1000 without decimals. This reduces formula complexity compared to nested IF statements.
Impact : Creates sophisticated formatting logic with cleaner, more maintainable formulas that are easier for other users to understand.
Test format codes with sample data before applying to large datasets. Create a small test area with various values (positive, negative, zero, decimals) to verify the format code produces expected results across all scenarios.
Impact : Prevents widespread formatting errors across entire reports and saves time debugging complex formatting requirements.
Useful Combinations
TEXT with CONCATENATE for Professional Labels
=CONCATENATE("Invoice Amount: ", TEXT(15750.5, "$#,##0.00"), " - Due: ", TEXT(TODAY(), "mm/dd/yyyy"))This combination creates complete formatted labels by concatenating descriptive text with TEXT-formatted numeric and date values. Useful for generating professional report headers, invoice details, or status messages that combine multiple data types with consistent formatting.
TEXT with IF for Conditional Formatting Display
=IF(A1>0, TEXT(A1, "$#,##0.00"), TEXT(A1, "($#,##0.00)"))Combines IF logic with TEXT to display positive values in standard currency format and negative values in accounting format with parentheses. This pattern is essential for financial reports where negative amounts require different visual treatment.
TEXT with VLOOKUP for Formatted Data Retrieval
=TEXT(VLOOKUP("Product_ID", DataTable, 3, FALSE), "$#,##0.00")Retrieves numeric values from lookup tables using VLOOKUP, then immediately formats them with TEXT. Ensures consistent formatting across reports regardless of source data formatting, preventing display inconsistencies in dashboards.
Common Errors
Cause: The format_text parameter contains invalid or unrecognized format codes, or the value parameter is text that cannot be converted to a number.
Solution: Verify format codes are valid Excel codes (like 'dd', 'mm', 'yyyy', '0', '#'). If formatting text, convert it to a number first using VALUE() function. Check for typos in format strings—'mmmm' works but 'mmmmmm' does not.
Cause: The formula is misspelled as 'TEXTT' or 'TEX', or the function name uses incorrect capitalization in some formula editors.
Solution: Verify the exact spelling is 'TEXT' with capital letters. Check that you're using the correct function name without extra characters. Ensure the formula starts with '=' sign.
Cause: The value parameter references a deleted cell or broken link, or the format_text references an invalid cell.
Solution: Check that all cell references in the formula still exist and contain valid data. If using named ranges, verify they haven't been deleted. Ensure format_text is either a literal string in quotes or a valid cell reference containing format codes.
Troubleshooting Checklist
- 1.Verify the value parameter contains a numeric value or date serial number—TEXT cannot format pure text strings
- 2.Confirm format_text is enclosed in quotation marks or references a cell containing valid format codes without extra spaces
- 3.Check that format codes use correct syntax: 'dd' for days (not 'ddd'), 'mm' for months (not 'mmm' for full name), 'yyyy' for four-digit years
- 4.Ensure you're not trying to perform mathematical operations on TEXT results—convert back to numbers with VALUE() if calculations are needed
- 5.Verify date serial numbers are correct (dates before 1900 cause errors); use DATE() function to create valid serial numbers
- 6.Test format codes with diverse sample values including negatives, zeros, and decimals to catch edge case formatting issues
Edge Cases
Formatting very large numbers (over 999 trillion) with thousand separators
Behavior: Excel may display scientific notation in the format code result if the formatted text exceeds cell width, or may truncate display
Solution: Widen the column containing the TEXT result, or use abbreviated format codes like '#,##0,,' to display millions/billions
Consider whether such large numbers require special formatting or data presentation approaches
Applying TEXT to dates near Excel's date boundary (dates before 1/1/1900 or after 12/31/9999)
Behavior: TEXT returns #VALUE! error for invalid date serial numbers outside Excel's supported range
Solution: Verify date serial numbers are within valid range; use DATE() function to ensure valid dates rather than manual entry
Excel's date system limitation affects historical and far-future dates that require special handling
Using TEXT with zero or negative time values (less than 0 or greater than 1)
Behavior: Negative times display with minus signs; values greater than 1 may display incorrectly depending on format code
Solution: Use format codes like '[hh]:mm:ss' with brackets to handle times exceeding 24 hours; ensure time values are between 0 and 1
Time values in Excel are stored as fractions of a day (0-1), so values outside this range require special handling
Limitations
- •TEXT cannot format pure text strings—it requires numeric, date, or time values as input; attempting to format text returns #VALUE! error
- •TEXT results are text strings that cannot be used in mathematical calculations; you must maintain separate numeric columns for calculations while using TEXT only for display
- •Some advanced custom format codes supported in cell formatting may not work identically in TEXT formula across different Excel versions or applications
- •TEXT formula performance may degrade when applied to very large datasets (100,000+ rows) compared to simple cell formatting; consider using conditional formatting for large-scale formatting needs
Alternatives
Compatibility
✓ Excel
Since 2007
=TEXT(value, format_text) - Identical syntax across all versions from Excel 2007 through Excel 365✓Google Sheets
=TEXT(value, format_text) - Fully compatible with nearly identical format codesMost format codes work identically; some advanced custom codes may require testing. Google Sheets documentation provides complete format code reference.
✓LibreOffice
=TEXT(value, format_text) - Compatible with minor variations in some advanced format codesFrequently Asked Questions
Explore Text
Related Formulas
Use Cases with this Formula
Excel invoice template for accountants
Excel freelance invoice template
Small business invoice template
E-commerce product catalog
Consultant invoice template
Marketing product sheet Excel