How to use RIGHT in Excel: extract characters from the end of text
RIGHT takes characters from the end of text: the last 4 card digits, a document number, a first name. Pairing with LEN and FIND, plus number traps.
RIGHT is LEFT’s mirror image: it takes the number of characters you need from the right side — the end — of a text.
Where it helps:
- The last 4 digits of a bank card — so the full number isn’t shown in a report.
- The sequence number from an invoice “INV-2025-0147” — 0147.
- The first name from “Karimov Aziz” — Aziz (RIGHT + LEN + FIND).
- The extension from a file name: “report.xlsx” → xlsx.
| A | B | C | D | |
|---|---|---|---|---|
| 1 | Client | Card number | Last 4 | |
| 2 | Aziz | 8600 1234 5678 90121 | 90122 | |
| 3 | Dilnoza | 9860 0101 2345 6789 | 6789 | |
| 4 | Javohir | 8600 5555 4444 3210 | 3210 | |
| 5 | Malika | 9860 1200 9876 0451 | 0451 | |
| 6 |
Syntax
=ПРАВСИМВ(text; [num_chars])
text— the text or a cell containing text.num_chars— how many characters to take from the end. If omitted — 1. Longer than the text — the whole text. Negative — #VALUE!.
Just like LEFT: a space is a character too, and the result is always text. That’s exactly why the leading zero in “0147” survives.
Writing RIGHT step by step
1
Select C2: Формулы → Текстовые → RIGHT.
| A | B | C | D | |
|---|---|---|---|---|
| 1 | Client | Card number | Last 4 | |
| 2 | Aziz | 8600 1234 5678 9012 | ||
| 3 | Dilnoza | 9860 0101 2345 6789 | ||
| 4 | Javohir | 8600 5555 4444 3210 | ||
| 5 |
2
Text — B2, Num_chars — 4. Click OK and fill the formula down.
| A | B | C | D | |
|---|---|---|---|---|
| 1 | Client | Card number | Last 4 | |
| 2 | Aziz | 8600 1234 5678 9012 | ||
| 3 | Dilnoza | 9860 0101 2345 6789 | ||
| 4 | Javohir | 8600 5555 4444 3210 | ||
| 5 | Malika | 9860 1200 9876 0451 | ||
| 6 |
3
Now build a “masked” number: type ="**** "&ПРАВСИМВ(B2;4) in D2. & joins text together — the full card number never appears in a report sent to the client.
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Client | Card number | Last 4 | For report | |
| 2 | Aziz | 8600 1234 5678 9012 | 9012 | **** 9012 | |
| 3 | Dilnoza | 9860 0101 2345 6789 | 6789 | **** 6789 | |
| 4 | Javohir | 8600 5555 4444 3210 | 3210 | **** 3210 | |
| 5 | Malika | 9860 1200 9876 0451 | 0451 | **** 0451 | |
| 6 |
Example: extracting the first name — RIGHT + LEN + FIND
You need first names from a “Surname Name” list. Names vary in length, so we calculate how many characters are needed:
=ПРАВСИМВ(A2;ДЛСТР(A2)-НАЙТИ(" ";A2))
LEN(A2)— the length of the whole text: “Karimov Aziz” is 12.FIND(" ",A2)— the position of the space: 8.- 12 − 8 = 4 — the number of characters after the space. RIGHT takes the last 4: “Aziz”.
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Full name | LEN | Space at | First name | |
| 2 | Karimov Aziz | 12 | 8 | Aziz | |
| 3 | Rahimova Dilnoza | 16 | 9 | Dilnoza | |
| 4 | Tursunov Javohir | 16 | 9 | Javohir | |
| 5 | Yusupova Malika | 15 | 9 | Malika | |
| 6 |
Example: turning a document number into a number
Invoices look like “INV-2025-0147”. =ПРАВСИМВ(A2;4) gives “0147”, but that is text: SUM and MAX ignore it (MAX returns 0), and comparisons with numbers go wrong.
If you need a number, wrap it in VALUE: =ЗНАЧЕН(ПРАВСИМВ(A2;4)) → 147. Look at the alignment: text sits on the left, numbers on the right.
| A | B | C | D | |
|---|---|---|---|---|
| 1 | Invoice | RIGHT (text) | VALUE (number) | |
| 2 | INV-2025-0147 | 0147 | 147 | |
| 3 | INV-2025-0152 | 0152 | 152 | |
| 4 | INV-2025-1200 | 1200 | 1200 | |
| 5 | Largest: | 0 | 1200 | |
| 6 |
Pro level: the part after the last delimiter
When codes have different numbers of parts (“UZ-SAM-12”, “UZ-TSH-CHL-0147”), FIND can’t locate the last hyphen — it finds the first one. The classic trick:
=СЖПРОБЕЛЫ(ПРАВСИМВ(ПОДСТАВИТЬ(A2;"-";ПОВТОР(" ";50));50))
SUBSTITUTEreplaces every hyphen with 50 spaces.RIGHT(…,50)takes the last 50 characters — only spaces and the last part are in there.TRIMremoves the spaces.
In Excel 365 it is much simpler: =ТЕКСТПОСЛЕ(A2;"-";-1) (-1 means the first delimiter from the end).
| A | B | C | D | |
|---|---|---|---|---|
| 1 | Code | Last part | ||
| 2 | UZ-TSH-CHL-0147 | 0147 | ||
| 3 | UZ-SAM-12 | 12 | ||
| 4 | UZ-BUX-GJD-A-5590 | 5590 | ||
| 5 |
Try it in the simulator
Type ="**** "&ПРАВСИМВ(B2;4) in C2 and fill it down to C5 to mask the cards. Then type =ПРАВСИМВ(A2;ДЛСТР(A2)-НАЙТИ(" ";A2)) in D2 to extract the first names.
| A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | Full name | Card number | For report | First name | ||||||||||||||||||||
| 2 | Karimov Aziz | 8600 1234 5678 9012 | ||||||||||||||||||||||
| 3 | Rahimova Dilnoza | 9860 0101 2345 6789 | ||||||||||||||||||||||
| 4 | Tursunov Javohir | 8600 5555 4444 3210 | ||||||||||||||||||||||
| 5 | Yusupova Malika | 9860 1200 9876 0451 | ||||||||||||||||||||||
| 6 | ||||||||||||||||||||||||
| 7 | ||||||||||||||||||||||||
| 8 | ||||||||||||||||||||||||
| 9 | ||||||||||||||||||||||||
| 10 |
Has ExcelLab been useful?
Support the project and help us release new lessons and exercises.