Remove the First or Last Characters in Excel
By ExcelReady TeamUpdated 6 min read
The short answer
To remove the first character in Excel, keep everything except it: =RIGHT(A2,LEN(A2)-1). LEN counts the characters and RIGHT keeps all but one from the end. To remove the last character, use =LEFT(A2,LEN(A2)-1). Change the 1 to any number to remove more characters, for example =RIGHT(A2,LEN(A2)-3).
Key takeaways
- Remove the first character with =RIGHT(A2,LEN(A2)-1); remove the last with =LEFT(A2,LEN(A2)-1).
- Change the 1 to remove more characters, or point it at a cell that holds the number.
- =REPLACE(A2,1,1,"") and =MID(A2,2,LEN(A2)) also remove the first character.
- The result is text, so wrap it in VALUE if you need a number you can add up.
- An empty cell makes LEN(A2)-1 negative and returns #VALUE!; guard it with IF(A2="","",...).
On this page+
To remove the first character in Excel, you don't delete anything. You keep everything except that character with =RIGHT(A2,LEN(A2)-1). The same idea, turned around, removes the last character: =LEFT(A2,LEN(A2)-1). This guide shows both, how to remove any number of characters, and how to avoid the errors that come from empty cells.
How do you remove the first character in Excel?#
Combine RIGHT and LEN: LEN counts the characters, and RIGHT keeps all of them except one. Here is the formula:
=RIGHT(A2,LEN(A2)-1)Read it from the inside out:
| Part | What it does | For X10432 |
|---|---|---|
LEN(A2) | Counts the characters in A2 | 6 |
LEN(A2)-1 | One fewer than the total | 5 |
RIGHT(A2,5) | Keeps the last 5 characters | 10432 |
The result is 10432. Because the formula works out the length for each cell, it works on text of any length. Fill it down (Windows: Ctrl+D; Mac: ⌘D) and every row loses exactly one character from the start.
If you are new to these functions, the guide to LEFT, RIGHT and MID for pulling out part of a cell explains each one with simple examples.
Two other ways to drop the first character#
REPLACE and MID give the same result, and some people find them easier to read. All three formulas below turn X10432 into 10432:
| Formula | How it works |
|---|---|
=RIGHT(A2,LEN(A2)-1) | Keeps all characters except the first |
=REPLACE(A2,1,1,"") | Replaces 1 character at position 1 with nothing |
=MID(A2,2,LEN(A2)) | Starts reading at character 2 and takes the rest |
REPLACE is the shortest: start at position 1, replace 1 character, put in "" (empty text). MID asks for more characters than are left, which is fine. MID simply stops at the end of the text.
Pick one and use it consistently. In a job test, RIGHT with LEN is the version examiners most often expect, because it shows you understand how LEN feeds the length.
How to remove the last character#
Swap RIGHT for LEFT to keep everything except the last character:
=LEFT(A2,LEN(A2)-1)This is useful for trailing punctuation or unit letters. To drop a two-letter unit such as kg, remove 2 characters instead of 1. Here are some common cases:
| A2 | Formula | Result |
|---|---|---|
Invoice; | =LEFT(A2,LEN(A2)-1) | Invoice |
125kg | =LEFT(A2,LEN(A2)-2) | 125 |
[Draft] | =MID(A2,2,LEN(A2)-2) | Draft |
The last row removes the first and the last character at once. MID starts at character 2 and takes the total length minus 2, which leaves out both ends.
How to remove the first or last N characters#
Change the 1 in the formula to however many characters you want to remove. To remove the first 3 characters of US-40512:
=RIGHT(A2,LEN(A2)-3)The result is 40512. To make the number easy to change, put it in a cell, say E1, and lock it with dollar signs:
=RIGHT(A2,LEN(A2)-$E$1)Now one edit in E1 updates every row. This works well when a data export adds a fixed prefix, such as a country code, that you need to strip.
Remove the first character only if it is a certain character#
Sometimes only some rows have the unwanted character. A list might mix X10432 with 20519, and you want to strip the X only where it exists. Check the first character with LEFT inside IF:
=IF(LEFT(A2,1)="X",RIGHT(A2,LEN(A2)-1),A2)If the first character is X, the formula removes it. If not, it returns the cell unchanged. The check is not case-sensitive, so a lowercase x is removed too. This is safer than removing one character from every row and losing a real digit by mistake.
When the part you want to remove is not a fixed length, such as everything before a dash, counting won't work. Use a delimiter instead: the comparison of LEFT and TEXTBEFORE for text before a character shows when each is better. The guide to removing unwanted characters with SUBSTITUTE covers characters that can appear anywhere in the cell.
Why does the formula return #VALUE! or the wrong result?#
Most problems come from cells that are shorter than you think, or longer. Check these:
Empty cells. If A2 is blank,
LEN(A2)-1is -1. RIGHT and LEFT can't take a negative length, so Excel shows #VALUE!. Guard against it:Excel formula=IF(A2="","",RIGHT(A2,LEN(A2)-1))Hidden spaces. A leading space counts as a character, so the formula removes the space instead of the letter. Clean the text first:
=RIGHT(TRIM(A2),LEN(TRIM(A2))-1). To check the length of a cell, the guide on counting characters with LEN helps.Numbers that won't add up. RIGHT, LEFT, MID and REPLACE always return text.
10432sits on the left of the cell and SUM ignores it. Wrap the formula in VALUE to get a real number:=VALUE(RIGHT(A2,LEN(A2)-1)).Numbers with formatting. If A2 is a number shown as
$1,250.00, LEN counts the stored value 1250, not what you see. Text functions work on the stored value.
Can you remove characters without a formula?#
Yes. Flash Fill copies a pattern you type. Type 10432 next to X10432, select the cell below, and press Ctrl+E on Windows (or use Data > Flash Fill, which works on both Windows and Mac). Excel fills the rest of the column.
Flash Fill gives you fixed values, not formulas, so the results don't update if the source changes. It also guesses the rule from your examples, so scan the results before you trust them. For data that changes, or for a test that asks for a formula, use RIGHT and LEN.
Practise it#
Removing characters is a small skill that shows up in data-cleaning tasks and job tests all the time. Practise LEFT, RIGHT, MID and LEN in a live spreadsheet: you type the formula, and it checks your answer instantly. For quick syntax reminders, keep the RIGHT function guide, the LEFT function guide and the LEN function guide open while you work, or try the exercise on this page first.
Try it yourself
This is a live spreadsheet. Type the formula in the green cell and press Enter.
Each ID has a letter X in front that the new system doesn't want. Click B2 and remove the first character from A2 with RIGHT and LEN, then press Enter.
| A | B | C | D | |
|---|---|---|---|---|
| 1 | Clean ID | |||
| 2 | X10432 | |||
| 3 | X20519 | |||
| 4 | X30077 | |||
| 5 | X41180 | |||
| 6 | X52046 | |||
| 7 | ||||
| 8 | ||||
| 9 |
Tip: LEN(A2) counts all six characters. Keep one fewer than that from the right.
Practise this in a lesson
Frequently asked questions
How do I remove the first character from a cell in Excel?
Use =RIGHT(A2,LEN(A2)-1). LEN counts all the characters, and RIGHT keeps all of them except the first one. =REPLACE(A2,1,1,"") gives the same result.
How do I remove the last character in Excel?
Use =LEFT(A2,LEN(A2)-1). It keeps every character from the start except the last one. Change the 1 to 2 or 3 to remove more.
How do I remove the first 3 characters in Excel?
Use =RIGHT(A2,LEN(A2)-3), or =MID(A2,4,LEN(A2)) to start reading at the fourth character. Both drop the first three characters.
Why does my formula return #VALUE!?
The cell has fewer characters than you are removing, often because it is empty. LEN(A2)-1 becomes negative, and RIGHT and LEFT cannot take a negative length. Wrap the formula in IF(A2="","",...) or IFERROR.
Can I remove characters without a formula?
Yes. Type the cleaned value next to the first row and use Flash Fill (Ctrl+E on Windows) to copy the pattern down. Check the results, because Flash Fill guesses the rule from your example.