How to remove the last N characters from a cell in Excel
Formula (Excel and Google Sheets)
=LEFT(A2,LEN(A2)-$E$1)Keep everything except the last N characters: =LEFT(A2,LEN(A2)-3).
- Result on the example
- one result per row in
B2, filled down toB6 - Works in
- Every current version
- Google Sheets
- Same formula
See it work
The formula is already in B2, filled down to B6. Change any input and the result updates, or edit the formula to experiment.
How it works
LEN(A2)-$E$1 is the length without the last N characters, and LEFT keeps that many from the start. Here it strips the "-01" revision suffix whatever the length of the invoice number.
In Google Sheets
The same formula works in Google Sheets: =LEFT(A2,LEN(A2)-$E$1). We ran it in Google Sheets mode on the same data and it returns the same results.
Other ways to do it
Each one was run on the same example sheet.
| Formula | Result | When to use it |
|---|---|---|
| =REPLACE(A2,LEN(A2)-$E$1+1,$E$1,"") | INV1042, INV1043, INV987… | Replaces the last N characters with nothing. |
Common mistakes
- Trailing spaces count as characters. TRIM first if the data was imported:
=LEFT(TRIM(A2),LEN(TRIM(A2))-3). - If N is larger than the text, LEFT gets a negative length and returns #VALUE!.
- When the suffix length varies, cut at the delimiter instead:
=TEXTBEFORE(A2,"-",-1).
Try it yourself
Same data, empty answer cell. Your formula is graded instantly, then re-checked on changed data, so a typed-in number won't pass.
Remove the last N characters from a cell
B2, remove the last N characters from the invoice, where N is in E1, and fill down to B6.Questions
How do I remove only the last character?
Use =LEFT(A2,LEN(A2)-1).
How do I remove the last character only if it is a comma?
Test it first: =IF(RIGHT(A2)=",",LEFT(A2,LEN(A2)-1),A2).
Checked by running on 2026-10-30: every formula and result on this page was calculated by the Spreadsheet Practice formula engine, in both Excel and Google Sheets modes.