Excel Function: VALUETOTEXT

Purpose

The VALUETOTEXT function converts a value’s data type to text. Its output is always a text value. It has two modes of operation: in default mode values are transformed into text and formatted according to the rules of Excel’s general format, and in strict mode text is generated which can be included in a formula. Strict mode augments default mode’s behaviour by replacing every double quote with 2 double quotes (“”) and enclosing the result as a whole between double quotes (“). For example, strict mode transforms the value xx”x into “xx””x”.

Invocations of the VALUETOTEXT function take the form:

VALUETOTEXT(value, [format])

Arguments

ArgumentArgument typeDescription
valueMandatoryA value to be converted into text.
formatOptional. Defaults to 0 if omitted.Used to set VALUETOTEXT’s mode of operation. It can assume one of two values:
ValueDescription
0Default mode. A value supplied to the value argument is transformed into text and formatted according to the rules of Excel’s “General” format.
1Strict mode. Generate values which can be included in formulae. A value supplied to the value argument is transformed into text and formatted according to the rules of Excel’s “General” format, has all instances of ” replaced with “” and the final output is enclosed between two ” characters.

Related Functions

FunctionExamplePurpose

Examples: Explanatory Notes

Example 1: Converting Text to Text

Default Mode

ExampleFormulaResultDescription
1=VALUETOTEXT("Lorem ipsum",0)Lorem ipsumConvert text containing no double quotes or line breaks.
2=VALUETOTEXT("Lorem
ipsum",0)
Lorem
ipsum
Convert text containing line breaks but no double quotes.
3=VALUETOTEXT("Lorem "" ipsum",0)Lorem " ipsumConvert text containing double quotes but no line breaks.

Strict Mode

ExampleFormulaResultDescription
1=VALUETOTEXT("Lorem ipsum",1)"Lorem ipsum"Convert text containing no double quotes or line breaks.
2=VALUETOTEXT("Lorem
ipsum",1)
"Lorem
ipsum"
Convert text containing line breaks but no double quotes.
3=VALUETOTEXT("Lorem "" ipsum",1)"Lorem "" ipsum"Convert text containing double quotes but no line breaks.

Example 2: Converting Numbers To Text

Default Mode

ExampleFormulaResultDescription
1=VALUETOTEXT(999,0)999Convert a 3 digit integer to text.
2=VALUETOTEXT(999.123,0)999.123Convert a decimal number whose mantissa has 3 digits to text.
3=VALUETOTEXT(1.00E+19,0)10000000000000000000Convert a large number to text.
4=VALUETOTEXT(1.00E+20,0)1E+20Convert a large number to text.

Strict Mode

ExampleFormulaResultDescription
1=VALUETOTEXT(999,1)999Convert a 3 digit integer to text.
2=VALUETOTEXT(999.123,1)999.123Convert a decimal number whose mantissa has 3 digits to text.
3=VALUETOTEXT(1.00E+19,1)10000000000000000000Convert a large number to text.
4=VALUETOTEXT(1.00E+20,0)1E+20Convert a large number to text.

Example 3: Converting Dates to Text

Default Mode

ExampleFormulaResultDescription
1=VALUETOTEXT(TODAY(),0)45056Convert today’s date to text.

Strict Mode

ExampleFormulaResultDescription
1=VALUETOTEXT(TODAY(),1)45056Convert today’s date to text.

Example 4: Converting Logicals to Text

Default Mode

ExampleFormulaResultDescription
1=VALUETOTEXT(TRUE,0)TRUEConvert TRUE to text.
2=VALUETOTEXT(FALSE,0)FALSEConvert FALSE to text.

Strict Mode

ExampleFormulaResultDescription
1=VALUETOTEXT(TRUE,1)TRUEConvert TRUE to text.
2=VALUETOTEXT(FALSE,1)FALSEConvert FALSE to text.

Example 6: Converting Currencies to Text

Default Mode

Example‘Value’ argumentResultDescription
1USD/EURUSD/EURConvert a currency pair to text

Strict Mode

Example‘Value’ argumentResultDescription
1USD/EUR"USD/EUR"Convert a currency pair to text

Example 5: Converting Errors to Text

Default Mode

Example‘Value’ argumentResultDescription
1#CONNECT!#CONNECT!Convert an error to text.

Strict Mode

Example‘Value’ argumentResultDescription
1#CONNECT!"#CONNECT!"Convert an error to text.

Example 7: Converting Geographies to Text

Default Mode

Example‘Value’ argumentResultDescription
1Washington, D.C.Washington, D.C.Convert geography data to text.

Strict Mode

Example‘Value’ argumentResultDescription
1Washington, D.C."Washington, D.C."Convert geography data to text.

Example 8: Converting Stocks to Text

Default Mode

Example‘Value’ argumentResultDescription
1MICROSOFT CORPORATION (XNAS:MSFT)MICROSOFT CORPORATION (XNAS:MSFT)Convert a stock to text.

Strict Mode

Example‘Value’ argumentResultDescription
1MICROSOFT CORPORATION (XNAS:MSFT)"MICROSOFT CORPORATION (XNAS:MSFT)"Convert a stock to text.