Excel TEXT Function: Format Numbers and Dates as Strings

Excel TEXT function — syntax, every format code you need for numbers, dates and times, real examples, common errors and when to use it instead of formatting.

Excel TEXT Function: Format Numbers and Dates as Strings

What the Excel TEXT Function Actually Does

The Excel TEXT function converts a numeric value into a formatted text string using a format code that you supply. The syntax is simple — =TEXT(value, format_text) — but the function is one of the most useful and most misunderstood tools in the entire Excel formula library. People who use it confidently can build dynamic report headers, professional-looking data exports and clean concatenated labels in seconds. People who do not understand it usually default to copying values, formatting cells one at a time, and writing fragile formulas that break the moment a number changes format.

The thing to grasp first is that TEXT changes the data type. The output is no longer a number that Excel can perform math on — it is a text string that happens to look like a number. That distinction is what makes TEXT both powerful and occasionally frustrating.

When you need a value to read "Total: $1,250.00 as of March 15, 2026" inside a single cell, TEXT is the right tool. When you need to keep doing arithmetic on the underlying value, format the cell and leave the value alone. Confusing the two situations is the source of nearly every TEXT-related question on Excel forums.

One quiet feature of TEXT is its compatibility across every modern Excel platform. The function works identically in Excel for Windows, Excel for Mac, Excel for the web, Excel for iPad and Excel for Android. The format code language is the same one Excel has used for cell formatting since the 1990s, which means knowledge of TEXT format codes is one of the few Excel skills that has remained completely stable across decades of platform changes.

Another point worth knowing is that TEXT respects the user's regional settings for some tokens but not others. The day, month and year tokens in date codes use the underlying Excel logic regardless of locale, which means yyyy-mm-dd produces a four-digit year and two-digit month no matter where the workbook is opened. The decimal and thousands separators in number format codes follow the locale of the active Windows or macOS installation, which can cause shared workbooks to render slightly differently between users.

TEXT function essentials

Syntax: =TEXT(value, format_text). Output: a text string. Common uses: dynamic labels, formatted concatenation, data exports. Format codes: "0.00" for two decimals, "#,##0" for thousands separator, "0%" for percent, "yyyy-mm-dd" for ISO dates, "mmmm dd, yyyy" for long dates, "h:mm AM/PM" for time. Result is text — not numeric, so subsequent SUM and AVERAGE calls will skip TEXT outputs.

Number Format Codes

The format code is the second argument to TEXT, and it is the same code language Excel uses internally for cell formatting. The most common codes for numbers cover decimals, thousands separators, percentages and currency. =TEXT(1234.567, "0.00") produces the string "1234.57" — Excel rounds rather than truncates the trailing digits. =TEXT(1234.567, "#,##0") produces "1,235" with the thousands comma and rounded to whole. =TEXT(0.42, "0%") returns "42%". =TEXT(1234.5, "$#,##0.00") produces "$1,234.50".

The pound sign "#" and zero "0" mean different things in format codes. "#" displays a digit only if it is significant — it suppresses leading and trailing zeros. "0" displays a digit even if it is zero, which is what produces zero-padding. =TEXT(7, "00000") returns "00007" with four leading zeros — useful for ZIP codes, employee IDs and product SKUs that need a fixed length. The decimal point in the format code anchors how digits split between the integer and fractional sides of the resulting string.

One subtle behaviour worth knowing is the four-section format syntax that some advanced TEXT codes use. A format code can include up to four sections separated by semicolons: positive number, negative number, zero and text. For example, "$#,##0.00;[Red]-$#,##0.00;-" applies different formatting to positive values, negatives and zeros respectively. The colour codes inside square brackets are honoured by cell formatting but ignored by the TEXT function — TEXT outputs only the literal characters and digits, never the colour itself.

Microsoft Excel - Microsoft Excel certification study resource

Most-Used Number Format Codes

"0.00"

Two decimal places, no thousands separator. =TEXT(1234.567, "0.00") → "1234.57". Use for laboratory readings, scores or simple precision.

"#,##0"

Thousands separator, no decimals. =TEXT(1234567, "#,##0") → "1,234,567". Standard for whole-number reports and dashboard headlines.

"#,##0.00"

Thousands separator with two decimals. =TEXT(1234.5, "#,##0.00") → "1,234.50". Default for currency, accounting and most business reports.

"0%" / "0.0%"

Percent. =TEXT(0.4567, "0.0%") → "45.7%". Excel multiplies by 100 and appends the percent sign automatically.

"$#,##0.00"

US dollar currency with two decimals. =TEXT(1500, "$#,##0.00") → "$1,500.00". Substitute other currency symbols for international formats.

"00000"

Zero-padded fixed length. =TEXT(7, "00000") → "00007". Use for ZIP codes, ticket numbers, employee IDs that need leading zeros.

Date and Time Format Codes

Dates and times in Excel are stored internally as serial numbers — the integer part counts days since 1 January 1900, and the decimal part counts the fraction of a day. TEXT converts those serial numbers into human-readable strings using the same date format language Excel uses for cell display. =TEXT(TODAY(), "yyyy-mm-dd") produces "2026-05-10" in ISO format. =TEXT(TODAY(), "mmmm dd, yyyy") produces "May 10, 2026". =TEXT(TODAY(), "ddd, mmm d, yyyy") produces "Sun, May 10, 2026".

The case of letters in the format code matters subtly. Lowercase "m" represents minutes when it follows "h" or "hh" (the hour token), and represents months everywhere else. =TEXT(NOW(), "h:mm AM/PM") renders the time correctly with minutes, while =TEXT(NOW(), "hh:m AM/PM") would mangle it because the "m" after "hh:" still reads as minutes but the single "m" produces unpredictable output. Capital "M" works the same as lowercase "m" for months in most locales, but using lowercase consistently avoids surprises in international Excel installations.

One often-missed convenience is the elapsed-hours bracket. =TEXT(2.5, "[h]:mm") returns "60:00" — sixty hours rather than rolling the value over after twenty-four. This is essential for timesheet totals that span multiple days, payroll calculations and project tracking sheets where total hours need to display as a continuous value rather than a clock time. Without the brackets, Excel resets to zero after every 24 hours, which is rarely what timesheet authors actually want.

Date and Time Format Examples

=TEXT(date, "yyyy-mm-dd") produces 2026-05-10 — the universal sortable date format used in databases, log files and exported reports. Always sorts correctly because the year leads.

Concatenation: Where TEXT Really Earns Its Keep

The most common use of the TEXT function is alongside concatenation, where it converts numbers and dates into properly formatted strings before they are joined to other text. Without TEXT, concatenated numbers come out raw — ="Total: " & A1 with A1 holding 1234.5 produces "Total: 1234.5" with no thousands separator and no consistent decimal precision. With TEXT, ="Total: " & TEXT(A1, "$#,##0.00") produces "Total: $1,234.50" — clean, professional and dynamic.

Dates suffer from the same raw-output problem. Concatenating a date directly produces a serial number, not a date string. ="As of " & A1 with A1 holding May 10, 2026 returns "As of 46133" — the serial number — which confuses anyone reading the output. Wrapping the date with TEXT solves it: ="As of " & TEXT(A1, "mmmm d, yyyy") returns "As of May 10, 2026". This pattern is the single most common reason people learn the TEXT function in the first place.

Another concatenation pattern worth remembering is conditional formatting inside the format code itself. ="Status: " & TEXT(A1, "\"On track\";\"Behind\";\"At goal\"") produces different display strings based on whether A1 is positive, negative or zero. The four-section format syntax inside TEXT enables this clean conditional output without nested IF statements, which keeps formulas concise and easier to maintain in shared workbooks.

Excel Spreadsheet - Microsoft Excel certification study resource

TEXT vs Cell Formatting: When to Use Which

The most common confusion in TEXT usage is the choice between calling the function and formatting the cell. Cell formatting changes how Excel displays a value without changing the underlying number — the cell still holds 1234.5 even though it shows as $1,234.50. The TEXT function actually replaces the number with a text string.

The decision rule is simple: if the value will be summed, averaged or used in further math, format the cell and leave TEXT out of it. If the value will be embedded in a label, concatenated with text, or exported as a literal string to another system, use TEXT.

A common pattern is to keep raw numeric values in a hidden helper column and use TEXT only in the display column where the formatted string is needed. Pivot tables, charts and slicers all read the raw values without any TEXT involvement. Reports that go to email or PDF use the TEXT-formatted display column. This separation of data and presentation is a hallmark of well-built spreadsheets, and the TEXT function is one of the tools that makes the separation possible.

Cell formatting is also faster from a recalculation perspective when applied to large ranges. A worksheet with 100,000 rows of currency-formatted cells recalculates more quickly than the same worksheet with 100,000 TEXT-formula cells producing equivalent strings. Formatting is essentially a display-layer operation that does not change the underlying data, while TEXT is a calculation that runs on every recalculation cycle. For very large datasets, this performance difference becomes meaningful.

TEXT Function Best Practices

  • Quote the format_text argument — TEXT(A1, "#,##0.00"), not TEXT(A1, #,##0.00)
  • Lowercase "m" for minutes only when it follows the hour token; uppercase or repeat to disambiguate
  • Use ISO format yyyy-mm-dd for any date that will be sorted, exported or shared internationally
  • Wrap TEXT output in VALUE() or DATEVALUE() if the next step needs a number again
  • Keep raw numeric data in helper columns; use TEXT only in the display layer
  • Test format codes with extreme values — very large numbers, zero, negatives, blanks
  • Document complex format codes in a comment so a colleague can read the formula
  • Avoid mixing TEXT output and raw numbers in the same column — chart software gets confused
  • Use TEXTJOIN with a delimiter when joining multiple TEXT results into one string

Phone Numbers, ZIP Codes and Custom Strings

The format code language can produce specific patterns beyond standard number and date formats. ZIP codes need leading zeros that Excel would otherwise drop because numbers do not store leading zeros. =TEXT(2138, "00000") produces "02138" — the format Excel needs to display Massachusetts ZIP codes correctly. Phone numbers in the US format use parentheses and dashes: =TEXT(2125550100, "(###) ###-####") produces "(212) 555-0100". Social Security numbers can be formatted with =TEXT(123456789, "000-00-0000") to produce "123-45-6789".

For custom strings that are not strictly numeric — alphanumeric product codes, license plate patterns, sortable identifiers — TEXT is less helpful and direct concatenation with the ampersand operator usually works better. The TEXT function is purely for converting numbers and dates into formatted text, not for string manipulation. When the input is already text, functions like LEFT, RIGHT, MID, SUBSTITUTE and TEXTJOIN do the work.

Mixing literal characters with format tokens is straightforward. Backslash before a special character forces it to display literally — =TEXT(123, "\#000") would show the pound sign followed by the padded number. Quoted text inside the format code also works for adding labels, although the syntax involves escaping the quotes within the formula itself, which is awkward enough that most authors prefer to concatenate plain text outside the TEXT function rather than embedding it inside the format code.

For barcodes, ISBNs and other fixed-length identifiers that mix digits and dashes, TEXT can produce specific patterns. =TEXT(9780132350884, "###-#-####-####-#") generates a hyphen-separated ISBN string from the numeric value. Combining several TEXT calls inside CONCAT or TEXTJOIN handles even more elaborate identifier patterns, although at some point a regular expression in Power Query becomes a cleaner solution.

Common Errors and How to Fix Them

The most common error from the TEXT function is the #VALUE! result, which appears when the format_text argument is not a valid format code. Typos like "yyyy-mm-d" with a single d at the end can return #VALUE! in some Excel versions because the format code is interpreted as ambiguous. Another classic mistake is using a region-specific code in a workbook opened in another locale — UK Excel reads day-month-year while US Excel reads month-day-year, and shared workbooks can produce different output depending on which Excel installation last opened them.

Another frequent source of confusion is the disappearance of leading zeros after data is exported. A column of zip codes saved through TEXT may export correctly to CSV, but importing the CSV back into Excel can strip the zeros if the column is auto-detected as numeric. The fix on import is to specify the column as text rather than letting Excel guess. The fix in advance is to add a text-format prefix character or to import using Power Query, which respects column types more reliably.

Locale-specific decimal and thousands separators also cause problems. US Excel uses period for decimal and comma for thousands; many European locales reverse the convention. Format codes that include these characters do not always translate automatically, which is why ISO dates and explicitly written codes survive cross-border sharing better than locale-default formats.

Pasting TEXT-formatted output into a new column also has a useful workaround. If you need to convert a column of TEXT formulas into static text values that survive deletion of the source data, copy the column and paste-special as Values. The result is a column of plain text strings that no longer references the original cells. This is the standard pattern for finalising a report before sending or archiving it.

Excellence Playa Mujeres - Microsoft Excel certification study resource

TEXT Function Quick Numbers

2Required arguments — value and format_text
4Section format code parts (positive;negative;zero;text)
100+Recognized format code tokens across categories
0Math operations TEXT output supports
1900Excel date serial number origin year
365Versions of Excel that support TEXT identically

TEXT in Context: Sister Functions

VALUE

Reverse of TEXT for numbers. =VALUE("123.45") returns the number 123.45 from a text string. Use after TEXT if you need to convert a formatted display string back into a number for further math.

DATEVALUE / TIMEVALUE

Reverse of TEXT for dates and times. =DATEVALUE("2026-05-10") returns the serial number for May 10, 2026. Useful when reading exported text-format dates back into Excel.

CONCAT / CONCATENATE

Joins TEXT results with other strings. CONCAT is the modern replacement for CONCATENATE — both produce the same output. Use the ampersand operator interchangeably for shorter formulas.

TEXTJOIN

Joins TEXT results with a delimiter and ignore-blank option. =TEXTJOIN(", ", TRUE, range) produces a comma-separated list. More flexible than chained ampersand concatenation for variable-length lists.

FIXED

Older sibling that formats a number with thousands and decimals. =FIXED(1234.5, 2) produces "1,234.50". Less flexible than TEXT but slightly shorter syntax for common formatting.

DOLLAR

Specialised currency formatter. =DOLLAR(1234.5, 2) produces "$1,234.50" using the local currency symbol. Largely superseded by TEXT with a custom currency format code.

Real-World Applications

Building dynamic dashboard headers is one of the most useful applications of TEXT. A formula like ="Sales Report — " & TEXT(EOMONTH(TODAY(), -1), "mmmm yyyy") produces "Sales Report — April 2026" and updates automatically each month. Pricing labels can use TEXT to produce currency strings inside merged-cell headers. File-naming macros use TEXT to generate sortable date stamps. Email automation through Power Automate or Office Scripts can embed TEXT-formatted values directly into outgoing message bodies.

Data export pipelines also rely heavily on TEXT. When exporting to CSV for an external system that expects a specific date format, prepping the data with TEXT into the exact format the consumer wants is more reliable than relying on Excel's default export behaviour. The same applies for fixed-width export columns, where TEXT with a zero-padded format guarantees consistent column widths regardless of input value range. These backstage uses of TEXT often outweigh the visible dashboard formatting.

Internationalisation is another quiet strength of TEXT. Users in non-US locales can write format codes that match their own currency, decimal and date conventions while preserving the formula logic. A formula written by a UK user with codes like "#,##0.00" and "d/m/yyyy" produces locale-appropriate output without any code change. The same formula opened by a US user displays the underlying logic transparently, although the comma-and-period interpretation may shift if the format codes contain literal separator characters.

Performance considerations also matter at scale. Dynamic array TEXT calls in modern Excel can format an entire range in one formula — =TEXT(A1:A1000, "$#,##0.00") fills 1,000 cells in a single instance. This is significantly faster than 1,000 separate TEXT calls and reduces workbook calculation time on large datasets.

The TEXT function pairs particularly well with the modern LET function, where intermediate calculations can be named and reused. A formula like =LET(price, A1, formatted, TEXT(price, "$#,##0.00"), "Total: " & formatted) keeps the formula readable when multiple TEXT-formatted values appear in a single output string. This pattern is common in dashboard formulas that build several display labels from the same underlying data.

TEXT Function vs Cell Formatting

Pros
  • +Converts a number or date to a formatted string in a single formula
  • +Produces output usable in concatenation and exports
  • +Locale-independent when ISO and explicit format codes are used
  • +Works inside complex formulas without changing the source data
  • +Available in every modern Excel version including Excel for the web
Cons
  • Output cannot be used in further numeric math without re-conversion
  • Format code syntax is its own learning curve
  • Locale differences can break formats on cross-border sharing
  • Adds complexity compared to simply formatting the cell when no concatenation is needed
  • Long format codes are difficult to read in formulas without comments

Excel Questions and Answers

About the Author

James R. HargroveJD, LLM

Attorney & Bar Exam Preparation Specialist

Yale Law School

James R. Hargrove is a practicing attorney and legal educator with a Juris Doctor from Yale Law School and an LLM in Constitutional Law. With over a decade of experience coaching bar exam candidates across multiple jurisdictions, he specializes in MBE strategy, state-specific essay preparation, and multistate performance test techniques.