# How to extract the first N characters from a cell in Excel

Use =LEFT(A2,3) to return the first 3 characters. Put the number in a cell, as in =LEFT(A2,$E$1), to change it easily.

**Excel:** `=LEFT(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 |
| --- | --- | --- | --- | --- |
| SKU | Category code |  | Characters | 3 |
| CHR-0142-BLK |  |  |  |  |
| DSK-2201-OAK |  |  |  |  |
| LMP-0087-WHT |  |  |  |  |
| MON-2710-SLV |  |  |  |  |
| CHR-0199-GRY |  |  |  |  |
| KBD-1005-BLK |  |  |  |  |

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

Result: CHR; DSK; LMP; MON; CHR; KBD

## How it works

LEFT returns a set number of characters from the start of the text. When every code has the same structure, like a three-letter category, that is all you need. If the length varies, split at a delimiter instead with TEXTBEFORE.

## Other ways

- `=MID(A2,1,$E$1)`: MID starting at position 1 does the same; it's the form to use when the start position can change.

## Common mistakes

- LEFT always returns text, even from a number: `=LEFT(12345,2)` is the text "12". Wrap it in VALUE to get a number.
- On a date, LEFT works on the serial number, not on what you see. Use TEXT first, like `LEFT(TEXT(A2,"yyyy-mm-dd"),4)`.
- Leaving out the second argument returns just 1 character.

## Questions

**How do I get everything except the first N characters?**

Use `=RIGHT(A2,LEN(A2)-$E$1)` or `=MID(A2,$E$1+1,LEN(A2))`.

**How do I get the text up to the first dash when the length varies?**

Use `=TEXTBEFORE(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/extract-first-n-characters
