---
schema_version: "1"
id: b04d46f25570de565584d669a0e3bacd5b0d41f68a6439f55dd933f71ca6aaf2
title: RIGHT
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/platform/264-0-0/customize_functions_right.md
canonical_url: https://help.salesforce.com/s/articleView?id=platform.customize_functions_right.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: 7db1d06fb9cffd113d35b0092ee2d3ce6395a71fe0042146633f1c5298aead50
description: Returns the specified number of characters from the end of a text string.
products:
  - Salesforce Platform
  - Security
release: "264"
---
# RIGHT

Returns the specified number of characters from the end of a text string.

## Use

`RIGHT(text, num_chars)` and replace text with the field or expression you want returned; replace num\_chars with the number of characters from the right you want returned.

## Tips

- Reference auto-number fields as text fields in formulas.
- If the num\_chars value is less than zero, Salesforce replaces the value with zero.

![Formula Example](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-platform-extend_click-264-0-0-production-enus/5f7d9219-b7b1-4552-8891-f1aba9b289fc/images/icon_example.png)

Formula Example `TRIM(LEFT(LastName, 5))&"-"&TRIM(RIGHT(SSN__c, 4))` displays the first five characters of a name and the last four characters of a social security number separated by a dash. Note that this formula assumes you have a text custom field called SSN