# LEFT, RIGHT, MID & LEN (Excel lesson 18 of 45)

> Cut text apart by position.

Source: https://spreadsheetpractice.com/learn/left-right-mid-len · Updated October 29, 2026

- **Course:** [Excel course](https://spreadsheetpractice.com/learn), track "Text cleanup"
- **Time:** about 8 minutes, 3 graded exercises
- **Functions:** `LEFT`, `RIGHT`, `MID`, `LEN`
- **Access:** Pro (the lesson text is free; the graded exercises need Pro)
- **Key formula:** `=LEFT(A2,2)`: First two characters

## How it works

`LEFT(text, n)` takes n characters from the start, `RIGHT(text, n)` from the end, and `MID(text, start, n)` from the middle. `LEN` counts the characters, which helps when pieces vary in length.

The results are text, even when they look like numbers: "0451" keeps its leading zero.

## Syntax

| Formula | What it does |
|---|---|
| `=LEFT(A2,2)` | First two characters |
| `=RIGHT(A2,4)` | Last four |
| `=MID(A2,4,4)` | Four characters starting at position 4 |
| `=LEN(A2)` | Character count |

## Watch out for

- Wrap the result in VALUE() if you need to do math with it.
- Count positions carefully: in NY-2026-0451 the year starts at character 4.

## The exercises

Solve them in the live grid at [LEFT, RIGHT, MID & LEN](https://spreadsheetpractice.com/learn/left-right-mid-len). Each answer is graded, then re-checked on changed data so typed-in numbers don't pass.

1. **City code.** In B2, extract the two-letter city code from the order code. Fill down to B6.
2. **Sequence number.** In C2, extract the last four characters. Fill down to C6.
3. **Year from the middle.** In D2, extract the four-digit year from the middle of the code. Fill down to D6.

Previous: [Last match, nearest value & wildcards](https://spreadsheetpractice.com/learn/xlookup-search-modes) · Next: [Joining text](https://spreadsheetpractice.com/learn/joining-text)

---

Spreadsheet Practice (https://spreadsheetpractice.com) teaches spreadsheet formulas by practice: every exercise is graded in a live grid and re-checked on changed data.
