In a company, order numbers are stored in a format like ORD-458921. The manager wants to create a short tracking code using only the last three digits of the order number.
However, Salesforce formulas cannot directly read text from right to left. To solve this, you can use the REVERSE() function.
First, reverse the order number so the last digits come to the front, then use the LEFT() function to pick the first three characters, and finally reverse it again to get the correct digits.
This way, from ORD-458921, you can easily extract 921 using a formula, which would otherwise be difficult to achieve.
In this article, we will learn about how to use the REVERSE() function in Salesforce with practical examples.
What is the REVERSE() Function in Salesforce?
The Salesforce REVERSE() function is one of several TEXT functions available in Salesforce that perform text operations on fields.
As its name refers to REVERSE, the Salesforce REVERSE function reverses the order of the characters in a provided text string. The function takes only one argument in the REVERSE function, that is, the text that we want to reverse.
Below is the syntax of the Salesforce REVERSE function:
REVERSE(text)
Here, the text parameter specifies the string we want to reverse.
How to REVERSE() Text Value in Salesforce
The following steps show how to use the REVERSE function to reverse a string value in Salesforce.
- Click the Setup icon in the top right corner of the page to access Salesforce Setup.
- Select Object Manager from the nav bar.

- Select the object in which you want to create the formula field to reverse the text value. Here I have selected the Campaign object.

- Select Fields & Relationships. Next, select New.

- Select “Formula“ as the field type. Click Next to proceed.
