# How to remove a prefix from text in Excel

Check for the prefix, then keep what follows it: =IF(LEFT(A2,LEN($E$1))=$E$1,MID(A2,LEN($E$1)+1,LEN(A2)),A2).

**Excel:** `=IF(LEFT(A2,LEN($E$1))=$E$1,MID(A2,LEN($E$1)+1,LEN(A2)),A2)` (Excel 2024 and Microsoft 365)

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

## Example

Sample data (row 1 is the header):

| A | B | C | D | E |
| --- | --- | --- | --- | --- |
| SKU | Without prefix |  | Prefix | SKU- |
| SKU-10442 |  |  |  |  |
| SKU-10457 |  |  |  |  |
| A2290 |  |  |  |  |
| SKU-B7731 |  |  |  |  |
| sku-10520 |  |  |  |  |

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

Result: 10442; 10457; A2290; B7731; 10520

## How it works

LEFT takes as many characters as the prefix has and compares them with it (ignoring case). When they match, MID returns everything after the prefix; when they don't, as for "A2290", the value is returned as it is. Only a prefix at the very start is removed.

## Other ways

- `=TEXTAFTER(A2,$E$1,,1,,A2)`: Excel 365: the text after the prefix, ignoring case (the 1), or the whole value when the prefix isn't there. It would also cut at a match in the middle.
- `=SUBSTITUTE(A2,$E$1,"",1)`: Quick, but case-sensitive and not limited to the start of the text. ("sku-10520" keeps its lowercase prefix.)

## Common mistakes

- SUBSTITUTE removes the text wherever it appears, not only at the start.
- Hard-coding the length, as in `MID(A2,5,…)`, breaks when the prefix changes. Use LEN of the prefix cell.

## Questions

**How do I remove a suffix instead?**

Check the end: `=IF(RIGHT(A2,LEN($E$1))=$E$1,LEFT(A2,LEN(A2)-LEN($E$1)),A2)`.

**How do I add the prefix back?**

Join it: `=$E$1&B2`.

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-a-prefix-from-text
