How to Text Function in Excel

Learn multiple Excel methods to text function with step-by-step examples and practical applications.

excelformulaspreadsheettutorial
11 min read • Last updated: 7/2/2025

How to Text Function in Excel

Why This Task Matters in Excel

In every spreadsheet, numbers and dates often need to be shown in a user-friendly way. Accountants publish financial statements, project managers create dashboards, marketers build client-facing reports, and analysts draft management presentations. In all of these deliverables the numbers must look professional: currency symbols must appear, thousands separators should be in the right places, percentages need two decimals, and dates must adopt regional or corporate formats. Doing this once manually is feasible, but in dynamic workbooks—where figures update every time the data refreshes—hand-typing formatted values is impossible.

The Text Function task solves this problem by providing a repeatable, formula-driven method to transform any numeric value or date into precisely the text string you need. For example, you can turn a raw serial date like 45261 into the friendly label “31-Mar-2024”, display 0.8532 as “85.32%”, or combine customer and order numbers into an invoice code such as “INV-2024-00057”.

Industry use cases abound. Finance departments generate narrative lines such as “Revenue grew by 12.5% compared with 2023” directly from live data. HR teams mail-merge salary letters, automatically converting base pay into “$75,000 per annum” without losing the underlying calculation. Logistics planners concatenate part codes, plant IDs, and production dates into bar-code labels. All of these rely on the Text Function so the workbook can keep its formulas but display readable text.

Excel is ideal for this formatting challenge because the platform separates value storage from value presentation. With the Text Function you retain the numerical accuracy required for modelling, yet simultaneously generate text that downstream processes—Power Query, Power Automate, Word mail merges, or CSV exports—can consume. Ignoring this skill leads to error-prone copy-pasting, broken number formats in CSV files, and confusing dashboards where “2.5E+05” replaces a properly formatted “250,000”. Mastering the Text Function therefore sits at the intersection of data integrity, reporting polish, and workflow automation.

Best Excel Approach

Excel offers two main ways to control how values look: cell formatting and the TEXT function. Cell formatting changes the appearance only, while the underlying cell still contains a number. That is perfect for on-screen reading, but it fails when you need the formatted result inside another formula, in an exported file, or as part of a label.

The TEXT function is the most powerful approach for converting numbers and dates into a text string with full control over the format code. Its syntax is:

=TEXT(value, format_text)
  • value – any numeric value, date, time, or reference to a cell that holds one.
  • format_text – a string that follows Excel’s custom number format rules, surrounded by quotation marks.

Use TEXT whenever you must embed formatted numbers inside larger strings, pass formatted values to other applications, or force a consistent locale-neutral pattern regardless of user settings. Resort to cell formatting only when you just need the on-screen look and don’t require the formatted result in further calculations.

Alternative approaches exist—such as CONCAT, TEXTJOIN, or the newer TEXTSPLIT/TOCOL functions combined with LET—but these still rely on TEXT internally for formatting. Therefore learning TEXT is the foundational method.

=CONCAT("Sales for ",TEXT(B2,"mmmm yyyy")," totaled ",TEXT(C2,"$#,##0.00"))

Parameters and Inputs

The TEXT function’s first input, value, must be a true number: integers, decimals, date-serials, or valid time values. Text that “looks like” a number will not work; convert it with VALUE or DATEVALUE first if necessary. Blank cells return a blank string, which can influence downstream formulas.

The second input, format_text, is a text string enclosed in double quotes. It follows the same rules you see in the Format Cells dialog but without the semicolon sections for negatives unless you explicitly include them. Common tokens include:

  • 0 – mandatory digit placeholder
  • – optional digit placeholder

  • ? – space for alignment
  • , – thousands separator
  • . – decimal separator
  • % – multiply by 100 and add percent sign
  • \"literal text\" – keep whatever’s inside quotes
  • d, m, y, h, s – date/time placeholders in various lengths

Ensure regional settings: using a comma for thousands in a locale that uses a period will give unexpected results. Always test your workbook on machines with different locale settings if it will be shared globally. Edge cases include negative numbers, zero values, and very large serial dates—explicitly define formats for them if needed, e.g. \"$#,##0.00;($#,##0.00);\"\"–\"\"\".

Step-by-Step Examples

Example 1: Basic Scenario – Convert a Date to Text

Imagine a small KPI table where column A contains raw sales dates and you need a header that reads “March 2024” to drive a pivot filter or to display in a chart title.

  1. Sample data
  • A2: 31-Mar-2024 (entered as a real Excel date)
  1. Target cell B2 should display “March 2024”.
  2. Enter the formula:
=TEXT(A2,"mmmm yyyy")
  1. Press Enter. B2 now shows “March 2024”.

Why it works: “mmmm” instructs Excel to spell out the full month name, while “yyyy” forces four-digit years. Because TEXT outputs a string, you can safely embed B2 in another phrase:

="Monthly Report: "&TEXT(A2,"mmmm yyyy")

Common variations

  • Short month: \"mmm yyyy\" returns “Mar 2024”.
  • Two-digit year: \"mmm yy\" returns “Mar 24”.
  • Include day suffix:
=TEXT(A2,"d")&IF(OR(DAY(A2)=11,DAY(A2)=12,DAY(A2)=13),"th",
 CHOOSE(MOD(DAY(A2),10)+1,"th","st","nd","rd","th","th","th","th","th","th"))
&" "&TEXT(A2,"mmmm yyyy")

Troubleshooting tip: If the output shows a serial number instead of the word, you forgot the quotation marks around the format_text argument.

Example 2: Real-World Application – Build an Invoice Code

A manufacturing company issues invoices that must follow the pattern “INV-2024-00057”, where the first part is literal, the second is the fiscal year, and the third is a five-digit, zero-padded sequence.

  1. Data layout
  • B2: Invoice Date (e.g., 15-Apr-2024)
  • C2: Invoice Number (e.g., 57)
  1. In cell D2, enter:
="INV-"&YEAR(B2)&"-"&TEXT(C2,"00000")
  1. Result: “INV-2024-00057”.

Why it works

  • YEAR extracts 2024 from the date, eliminating hard-coding the fiscal year.
  • TEXT ensures the sequence always displays five digits, even when C2 contains a single-digit value.

Business benefit: This approach lets you mail-merge an invoice list into Word documents or create QR codes without post-editing. As the year changes, the formula updates automatically.

Integration with other Excel features

  • Use structured references in an Excel Table to auto-fill new rows.
  • Feed the generated code into Data Validation lists or XLOOKUPs in other sheets.

Performance considerations: Even at 50,000 rows, TEXT is lightweight because it is a single-threaded string conversion. The main overhead comes from the YEAR function and concatenation, but modern hardware handles hundreds of thousands of rows easily.

Example 3: Advanced Technique – Dynamic Conditional Formats Inside TEXT

Suppose a financial dashboard must state:
“Net Profit: USD 5.3 million (increase of 12.50%)” for positive growth, or
“Net Profit: USD 4.7 million (decrease of 8.45%)” for negative growth.

  1. Data
  • G2: Net Profit in USD (e.g., 5342000)
  • H2: Growth percentage (e.g., 0.125)
  1. Target formula in I2:
="Net Profit: USD"&TEXT(G2/1000000," #,##0.0")&" million ("&
 IF(H2>=0,"increase of ","decrease of ")&
 TEXT(ABS(H2),"0.00%")&")"
  1. Explanation
  • Divide G2 by one million to show “millions” rather than full numbers.
  • TEXT applies space before the number for readability and one decimal place, with thousands separators.
  • The IF function injects “increase” or “decrease” depending on sign.
  • ABS ensures the percentage is always positive in text, while TEXT formats it with two decimals and a percent sign.

Edge case handling

  • If H2 is exactly zero, you may want “no change” rather than increase/decrease. Wrap the IF in another layer:
=IF(H2=0,"Net Profit: USD"&TEXT(G2/1000000," #,##0.0")&" million (no change)",
 "Net Profit: USD"&TEXT(G2/1000000," #,##0.0")&" million ("&
 IF(H2>0,"increase of ","decrease of ")&TEXT(ABS(H2),"0.00%")&")")

Professional tips

  • Use LET in Microsoft 365 to avoid repeating long expressions and improve performance:
=LET(
 profit,G2,
 growth,H2,
 "Net Profit: USD"&TEXT(profit/1000000," #,##0.0")&" million ("&
 IF(growth=0,"no change",
  IF(growth>0,"increase of ","decrease of ")&TEXT(ABS(growth),"0.00%"))&")")

Tips and Best Practices

  1. Always lock your format_text argument in quotes, even when it references another cell indirectly.
  2. Keep custom format codes in a hidden helper table and refer to them with INDIRECT or XLOOKUP for easy maintenance.
  3. Combine TEXT with CONCAT or TEXTJOIN (Microsoft 365) to assemble long messages without many ampersands, improving readability.
  4. Avoid using TEXT on values that still need to participate in arithmetic; once converted, they are non-numeric. Maintain a separate numeric column for calculations.
  5. Use the upon-calculation settings in File → Options → Advanced → “Set precision as displayed” cautiously; leave the underlying numbers intact and rely on TEXT for display only.
  6. When you export CSV files, remember that TEXT is required to keep leading zeros—cell formatting alone will be lost during export.

Common Mistakes to Avoid

  1. Forgetting the quotes around format_text: Excel returns #NAME? because it thinks the format is an undefined range name. Double-check quotation marks.
  2. Mis-ordering day and month tokens in international teams: “dd/mm/yyyy” vs “mm/dd/yyyy”. Explicitly specify or centralize the format code.
  3. Using TEXT on already formatted text, leading to doubled symbols (e.g., \"$$10.00\"). Test the data type with ISNUMBER first.
  4. Concatenating numeric results without TEXT when building reports; you will see “2.34567E+05” instead of “234,567”. Always wrap with TEXT.
  5. Omitting a specific format for negative numbers; a financial statement may show “(123,456)” while TEXT gives “-123456”. Include a custom negative section in the format string if style requires parentheses.

Alternative Methods

MethodProsConsBest For
Cell FormattingQuick, no formulas, preserves numeric valueLoses effect when exporting; cannot concatenateSimple on-screen tables
TEXT FunctionFull control, works in concatenation, locale-neutralConverts to text; not suitable for further mathsDynamic reports, exports
TEXTJOIN/CONCAT with TEXT insideEasier to build long strings, cleanerStill needs nested TEXT calls for each numberNarrative reports with many fields
DAX FORMAT (Power Pivot)Works in data models, reports in Power BIOnly inside measures; not usable in grid formulasData models and dashboards
Custom VBAComplete flexibility, conditional logicMaintenance overhead, macros disabled in some environmentsComplex document generation

Performance: TEXT is extremely fast for tens of thousands of rows, whereas VBA loops can slow down; choose VBA only when you need bespoke rules like spelling out numbers (“One hundred twenty-three”).

FAQ

When should I use this approach?

Use TEXT when you must embed a formatted number or date into another string, export a CSV with preserved formatting, or create a label that combines numeric and textual data dynamically.

Can this work across multiple sheets?

Yes. Reference cells on other sheets in the value argument, e.g. =TEXT(Sheet2!B5,"0.00%"). The format_text can also be stored on another sheet to centralize changes.

What are the limitations?

TEXT converts numbers to text, so the result is no longer numeric. You cannot sum or average the output. Also, format codes rely on English tokens; locale-specific separators may affect results.

How do I handle errors?

Wrap your TEXT call in IFERROR to catch blanks or conversion errors: =IFERROR(TEXT(A2,"$#,##0"),"N/A"). For #VALUE! errors, confirm the value argument is numeric.

Does this work in older Excel versions?

TEXT has existed since early Excel releases, so compatibility back to Excel 97 is solid. Newer helper functions like TEXTJOIN or LET require Microsoft 365 or Excel 2021.

What about performance with large datasets?

TEXT is lightweight and vectorized. In workbooks with hundreds of thousands of rows, calculation time is dominated by volatile functions and lookup formulas, not TEXT. Cache repeated calls with LET where possible.

Conclusion

Mastering the Text Function unlocks professional-looking, dynamic reports without sacrificing numerical accuracy. Whether you are generating invoice IDs, succinct dashboard captions, or export-ready CSV files, TEXT provides the flexibility to control every digit, symbol, and date element. As you integrate this skill with CONCAT, TEXTJOIN, and other modern functions, your workbooks become easier to read, simpler to maintain, and less prone to formatting errors. Continue practicing by re-creating your department’s routine templates using TEXT and explore advanced techniques like conditional formats inside LET for even cleaner formulas.

We use tracking cookies to understand how you use the product and help us improve it. Please accept cookies to help us improve.