RIGHT Function
Purpose
Returns the last character or characters in a text string, based on the number of characters you specify.
Syntax
EXCEL
=RIGHT(text, [num_chars])
Arguments Breakdown
| Argument | Required? | Description |
|---|---|---|
text |
Required | The text string that contains the characters you want to extract. |
num_chars |
Optional | The number of characters to extract from the right side (defaults to 1 if omitted). |
Practical Examples
1. Extract Trailing Characters Drill
From Formulas_&_Functions_Part_1.xlsx:
If A1 contains "Mostafa":
EXCEL
=RIGHT(TRIM(A1), 4)
Result: "tafa".
2. Extract Numerical Serial from Superstore Order ID
In Superstore dataset: Order ID = "CA-2016-152156"
EXCEL
=RIGHT([@[Order ID]], 6)
Result: "152156".
3. Dynamic Last Name Extraction
EXCEL
=RIGHT(A2, LEN(A2) - SEARCH(" ", A2))
Behavior Rules
num_charsmust be $\ge 0$.- If
num_charsis greater than the total length oftext,RIGHTreturns all oftext.
Related Knowledge
- Notes: 05 Text Manipulation Functions
- Workbook:
11_Demos_and_Workbooks/03_Formulas_and_Functions/Formulas_&_Functions_Part_1.xlsx(Sheet:Text)