# How to remove the last N characters from a cell in Excel

Keep everything except the last N characters: =LEFT(A2,LEN(A2)-3).

**Excel:** `=LEFT(A2,LEN(A2)-$E$1)` (Every current version)

**Google Sheets:** the same formula works.

## Example

Sample data (row 1 is the header):

| A | B | C | D | E |
| --- | --- | --- | --- | --- |
| Invoice | Base invoice |  | Remove | 3 |
| INV1042-01 |  |  |  |  |
| INV1043-02 |  |  |  |  |
| INV987-01 |  |  |  |  |
| INV10450-03 |  |  |  |  |
| INV1046-01 |  |  |  |  |

Formula in B2, filled to B6: `=LEFT(A2,LEN(A2)-$E$1)`

Result: INV1042; INV1043; INV987; INV10450; INV1046

## 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.

## Other ways

- `=REPLACE(A2,LEN(A2)-$E$1+1,$E$1,"")`: 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)`.

## 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)`.

Every formula and result on this page was checked by running it in the Spreadsheet Practice formula engine on 2026-10-30.

Source: https://spreadsheetpractice.com/formulas/remove-last-n-characters
