Excel + Google Sheets · RIGHT
Mask numbers with RIGHT
RIGHT returns the last characters of a text.
The formula
="**** " & RIGHT(A2, 4)What each part means
A2The text4Last 4 characters
Example
| A | B | |
|---|---|---|
| 1 | Account | Masked |
| 2 | 4539 1488 0343 6467 | |
| 3 | 5500 0055 5555 5559 | |
| 4 | 6011 1111 1111 1117 |
| A | B | |
|---|---|---|
| 1 | Account | Masked |
| 2 | 4539 1488 0343 6467 | **** 6467 |
| 3 | 5500 0055 5555 5559 | **** 5559 |
| 4 | 6011 1111 1111 1117 | **** 1117 |
Step by step
- Click cell B2.
- Type the formula:
="**** " & RIGHT(A2, 4) - Press Enter.
- Drag the small square in the bottom-right corner of the cell down to copy it to the other rows.
Where it works
- Every version of Excel
- Google Sheets
- Excel for the web (free)