Loading
Prepare for Email to Become the Default Login ExperienceRead More
Ongoing maintenance for Salesforce HelpRead More
Extend Salesforce with Clicks, Not Code
TEXT

TEXT

Converts a percent, number, date, date/time, or currency type field into text anywhere formulas are used. Also, converts picklist values to text in approval rules, approval step rules, workflow rules, escalation rules, assignment rules, auto-response rules, validation rules, formula fields, field updates, and custom buttons and links.

Use

TEXT(value) and replace value with the field or expression you want to convert to text format. Avoid using any special characters besides a decimal point (period) or minus sign (dash) in this function.

Tips

  • The returned text is not formatted with any currency, percent symbols, or commas.
  • Values are not sensitive to locale. For example, 24.42 EUR is converted into the number 24.42.
  • Percents are returned in the form of a decimal.
  • Dates are returned in the form of YYYY-MM-DD, that is, a four-digit year and two-digit month and day.
  • Date/time values are returned in the form of YYYY-MM-DD HH:MM:SSZ where YYYY is a four-digit year, MM is a two-digit month, DD is a two-digit day, HH is the two-digit hour, MM are the minutes, SS are the seconds, and Z represents the zero meridian indicating the time is returned in UTC time zone.
  • Picklist fields are supported in TEXT functions used in these kinds of formulas: validation rules, approval rules, approval step rules, workflow rules, escalation rules, assignment rules, auto-response rules, formula fields, field updates, and custom buttons and links. In other formulas, use ISPICKVAL or CASE when referencing a picklist field.
  • If the text value you enter is a URL, the text automatically converts as a hyperlink.
  • When converting decimal results to text in Lightning, leading zeros are removed. When converting decimal results to text in Classic, leading zeros are retained.
Expected Revenue in Text Example
Expected Revenue in Text Example

TEXT(ExpectedRevenue) returns the expected revenue amount of an opportunity in text format without a dollar sign. For example, if the Expected Revenue of a campaign is "$200,000," this formula field displays “200000.”

Asset ID Example
Asset ID Example

SerialNumber &"-"& TEXT(Quantity) returns an asset ID number starting with the serial number and ending with the quantity separated by a dash. The Serial Number field is already text but the Quantity field is a number, requiring the TEXT function before it.

Picklist Values in Math Equations Example
Picklist Values in Math Equations Example
VALUE(LEFT(TEXT(Quantity), 5)) * Unit

This formula multiplies the first five numbers of the Quantity picklist by the Unit numeric field.

Compare Two Picklists Example
Compare Two Picklists Example
IF(TEXT(bug_status) = TEXT(case_status), "Match", "Out of Sync")

This formula compares the values of the bug_status picklist with values of the case_status picklist.

Picklist Values from Parent Records Example
Picklist Values from Parent Records Example
TEXT(Account.Industry)

This formula field on opportunities shows the industry of the associated account.

Concatenate Picklist Values Example
Concatenate Picklist Values Example
TEXT(Account.Industry) & " - " & TEXT(Account.SubIndustry__c)

This formula field on opportunities shows the industry and subindustry of the associated account.

Validation Rule Example: Block the Save of a Closed Opportunity
Validation Rule Example: Block the Save of a Closed Opportunity

CONTAINS(TEXT(Status), "Closed") returns TRUE if the Status picklist contains the value “Closed,” such as “Closed Won” and “Closed Lost.” This validation rule formula blocks users from saving changes to a closed opportunity.

Validation Rule Example: Use Numeric Functions on Numeric Picklist Values
Validation Rule Example: Use Numeric Functions on Numeric Picklist Values

VALUE(LEFT(TEXT(Quantity), 5)) * Unit > 10000 multiplies the first five numbers of the Quantity picklist by the Unit numeric field, and returns TRUE if the result is greater than 10,000.

Directly Compare Two Picklists Example
Directly Compare Two Picklists Example

TEXT(bug_status) = TEXT(case_status) compares the values of the bug_status picklist with values of the case_status picklist, and returns TRUE if they are equal.

 
Loading
Salesforce Help | Article