Text functions
VALUETOTEXT
Matches all 6 recorded answers
Recorded: 6 workbook cells. How we measure this · See the Rust code
Local names in 40 languages
| Language | Name in Excel |
|---|---|
| Arabic | VALUETOTEXT |
| Bulgarian | VALUETOTEXT |
| Czech | VALUETOTEXT |
| Danish | VÆRDITILTEKST |
| German | VALUETOTEXT |
| Greek | VALUETOTEXT |
| English (Australia) | VALUETOTEXT |
| English (United Kingdom) | VALUETOTEXT |
| English (United States) | VALUETOTEXT |
| Spanish | VALORATEXTO |
| Estonian | VALUETOTEXT |
| Finnish | ARVO.TEKSTIKSI |
| French | VALEUR.EN.TEXTE |
| Hebrew | VALUETOTEXT |
| Croatian | VALUETOTEXT |
| Hungarian | ÉRTÉK.SZÖVEGGÉ |
| Indonesian | VALUETOTEXT |
| Italian | VALUETOTEXT |
| Japanese | VALUETOTEXT |
| Korean | VALUETOTEXT |
| Lithuanian | VALUETOTEXT |
| Latvian | VALUETOTEXT |
| Norwegian | VALUETOTEXT |
| Dutch | VALUETOTEXT |
| Polish | WARTOŚĆ.NA.TEKST |
| Portuguese (Brazil) | VALUETOTEXT |
| Portuguese (Portugal) | VALORPARATEXTO |
| Romanian | VALUETOTEXT |
| Russian | ЗНАЧЕНИЕВТЕКСТ |
| Slovak | VALUETOTEXT |
| Slovenian | VALUETOTEXT |
| Serbian (Latin) | VALUETOTEXT |
| Swedish | VÄRDETILLTEXT |
| Thai | VALUETOTEXT |
| Turkish | DEĞERMETİN |
| Ukrainian | VALUETOTEXT |
| Vietnamese | VALUETOTEXT |
| Chinese (Simplified) | VALUETOTEXT |
| Chinese (Hong Kong) | VALUETOTEXT |
| Chinese (Traditional) | VALUETOTEXT |
Names from Microsoft's support site.
What it does
VALUETOTEXT(value, [format])
VALUETOTEXT renders a value as text. Its reason to exist is that Excel has two different, equally
legitimate answers to "what does this value look like as text", and this function lets you ask for
either one.
Concise (format = 0, the default) returns the value as it would be rendered in a cell with
General formatting. This is the display register: it is what a human reading the sheet sees.
Microsoft's page states this equivalence explicitly, and it is the useful anchor — the output is
defined by reference to General-format rendering, not by an independent formatting rule.
Strict (format = 1) returns the value in a form suitable for embedding in a formula.
Microsoft's page describes it as including escape characters and row delimiters, and generating a
string that can be parsed when entered into the formula bar. Text is quoted, with inner quotes
escaped; Booleans, numbers and errors are left unquoted. This is the round-trip register: the point
is that pasting the result into the formula bar reconstructs the value.
The distinction is exactly the distinction between showing a value and denoting it. "Hello"
displays as Hello and denotes as "Hello". The empty string displays as nothing and denotes as
"" — and only the second of those two is recoverable.
For anyone building tooling on top of a workbook, that makes strict mode the interesting one: it is the only ordinary worksheet function that produces a machine-reparseable rendering of an arbitrary value.
Arguments
VALUETOTEXT(value, [format])
| Argument | Required | Meaning (as documented by Microsoft) |
|---|---|---|
value | yes | The value to return as text. |
format | no | 0 (default) concise; 1 strict. Anything else is documented as #VALUE!. |
The format argument is a mode selector with exactly two admitted values, and this is one of the
few places in the text family where an out-of-range option is documented as an error rather than
being clamped or ignored. Do not pass TRUE expecting it to mean 1 without checking; whether the
logical coerces into the admitted set is not something this page asserts.
The first position takes any value, which is the function's whole point. It is not restricted to scalars in the sense of rejecting other kinds — it is the scalar renderer, and how it responds to an array argument is discussed below.
Try it
Quirks
Result and edge cases
The return kind is Text. Upstream's contract records the result as always a scalar text value.
- Errors are rendered, not propagated, in one specific sense — and propagated in another. Microsoft's strict-mode description says errors are left unquoted, which implies they are rendered as their error text. Upstream's contract, by contrast, records error values in the first argument as propagating in both format modes. These two readings can both be true of different situations — an error inside an array being rendered, versus an error arriving as the whole scalar argument — but the Handbook has not established which applies where. This is a genuine open point and it is listed below rather than resolved by assertion.
- Numbers render as decimal strings in concise mode, which means the General-format rendering,
including its width-dependent behaviour in a cell. Whether
VALUETOTEXT's rendering depends on column width the way a cell's does is not established and is a probe worth running. - The empty string is distinguishable in strict mode (
"") and not in concise mode. - An empty referenced cell delivers
Empty, distinct from an omitted argument; see the value universe. - Array arguments.
ARRAYTOTEXTis the function for arrays. WhetherVALUETOTEXTlifts elementwise over an array or delegates to array rendering is a shape question the Handbook has not settled; see the probes below.
Errors
The tension between error propagation and error rendering noted above is unresolved; treat the second row as upstream's reading rather than as settled Handbook fact.
How to implement
Notes for implementers
- Do not write your own number renderer. Concise mode is defined as General-format rendering,
so it inherits every subtlety of that: the switch to scientific notation, the significant-digit
budget, negative-zero handling. Reusing the engine's General formatter is the only way to stay
consistent; a fresh
format!("{}", x)will diverge. - Strict mode is a grammar, so write it as one. Quoting, quote-escaping (doubling), the column separator, and the row separator are all part of a syntax that must reparse. The separator characters are locale-dependent in Excel's formula language, which means strict mode has a locale dependency that concise mode does not obviously share.
- The two modes must agree on nothing. Do not implement strict as concise-plus-quotes; the number renderings can legitimately differ.
- Decide the error question explicitly and test it: error as argument, error inside an array,
and error as the
formatargument are three different paths. - Validate
formatbefore rendering, so thatVALUETOTEXT(error_value, 7)has a defined precedence between the two failures.
Rust code
Show the CalcFunc source of this function
Quoted from the public repository DnaCalc/DnaCalc, crates calc-func and calc-fml, at commit 9e1884369a67. Comments are the source's own. A kernel shared with other functions appears once, on its module page.
VALUETOTEXT · 1 lines · calc-func/src/catalogue/text_format.rs on GitHub6 valuetotext_fn "VALUETOTEXT" (1, 2) [V "value", V "format"] |s, a, sv| { valuetotext(s, a) }
valuetotext · 5 lines · calc-func/src/catalogue/text_format.rs on GitHubfn valuetotext(site: &Site<'_>, a: &[CalcValue]) -> Step<CalcValue> {
let strict = binary_flag(site, a, 1)?;
let shown = value_text(site, 0, &a[0], strict)?;
Ok(crate::catalogue::kit::text_value(&shown))
}
Kernels shared with other functions
read_valuecatalogue/text_formatvaluecatalogue/text_formatprofilecatalogue/text_formatrenderedcatalogue/text_formattextcatalogue/text_formatgivencatalogue/text_formatbinary_flagcatalogue/text_formatvalue_textcatalogue/text_formatlow32decimalNatural::zerodecimalNatural::from_u64decimalNatural::pow10decimalNatural::normalizedecimalNatural::is_zerodecimalNatural::mul_add_smalldecimalNatural::times_pow10decimalNatural::times_pow5decimalNatural::times_pow2decimalExactDecimal::readdecimalExactDecimal::binarydecimalhas_invalid_exponentformat/datetimelooks_like_datetime_formatformat/datetimewithout_subsecondsformat/datetimerender_with_datetime_tokensformat/datetimetokenize_datetime_formatformat/datetimeelapsed_token_atformat/datetimeclassify_minute_tokensformat/datetimetoken_kindformat/datetimeis_time_neighborformat/datetimepush_literalformat/datetimerender_datetime_literalformat/datetimeformat_elapsedformat/datetimeTimeParts::from_serialformat/datetimemeasured_hostformatcurrency_literalformatdigitsformatfifteenformatsplitformatgroupedformatgeneralformatsignificantformatsectionsformatbracketformatis_conditionformatis_elapsedformatcondition_holdsformatcondition_offormatstrip_tokensformatchooseformatitemsformatnumericformatliteral_textformatinteger_partformatfraction_partformatscientificformatfraction_codeformatFractionCode::renderformatmixed_fraction_under_space_groupingformatconvergentformattext_declared_date_localeformattextformattext_of_textformatmonth_nameformat/namesweekday_nameformat/nameslocale_namesformat/namesLocaleId::from_bcp47_language_taglocaleLocaleId::from_excel_lcidlocaleshort_date_orderlocaleshort_date_patternlocalecurrency_placementlocalecurrency_spacinglocalecurrency_negative_patternlocaleformat_profilelocaledays_from_civillocalecivil_from_dayslocaleymd_from_excel_seriallocaledecimalnumber_textfirst_precisionnumber_textnear_tienumber_textfirst_roundingnumber_textroundednumber_textincrementnumber_textasciinumber_textdays_from_civilported/date_kernelscivil_from_daysported/date_kernelsserial_unbounded_1900ported/date_kernelsymd_1900ported/date_kernelsis_leapported/date_kernelsdays_in_monthported/date_kernelswhole_serialported/date_kernelswholeported/date_kernelsweekday_sunday_one_basedported/date_kernelsremap_weekdayported/date_kernelsweekday_ofported/date_kernelsweekdayported/date_kernelstextported/text_kernelstext_from_strported/text_kernelsdate_integer_floorported/text_kernelspush_singleton_or_originalported/text_kernelspush_upperported/text_kernelsupperported/text_kernelserror_literalported/text_moremeasured_host_readervalue_textmeasured_spacevalue_textreadvalue_textnumbervalue_textdecimalvalue_textfractionvalue_texttokensvalue_textmonth_namedvalue_texttime_atvalue_textfull_yearvalue_textvalid_dayvalue_textthis_yearvalue_textserial_1900value_textdate_ofvalue_textdate_timevalue_text
Argument and result plumbing
No implementation has been published with a Handbook test suite for this function.
Version differences
No comparison between specific Excel builds is recorded here yet. This does not establish that all builds behave alike.
Alternatives
Relationships
ARRAYTOTEXT— the array counterpart, introduced alongside this function and sharing itsformatargument and its two registers. The pair splits by input shape: one value, or a grid.TEXT— the formatting function, and the one readers confuse with this.TEXT(x, fmt)applies a number-format string you supply;VALUETOTEXTapplies General formatting or a fixed strict grammar.TEXTcannot render a logical or an error usefully;VALUETOTEXTis defined for every value kind.VALUE— despite the name, not the inverse.VALUEparses text into a number under locale rules;VALUETOTEXTrenders any value as text. The nearest thing to an inverse of strict mode is the formula parser itself.T— the old narrow relative: returns the text if the argument is text and the empty string otherwise. It is a filter, not a renderer.CONCATand&perform implicit to-text conversion by the general rule in coercion and lifting. That conversion is not guaranteed to agree withVALUETOTEXT(x, 0)for every kind, and where they differ is worth knowing.
Named variants
No named variants are recorded yet.
Suggest a correction or contribute an implementation · For agents