Excel text functions (LEFT, RIGHT, MID, LEN) practice exercises
5 graded problems with realistic data, all medium.
LEFT, RIGHT, MID, LEN, TRIM, SEARCH, and SUBSTITUTE: the everyday toolkit for slicing, inspecting, and cleaning up text. The 5 exercises below come from LearnExcel's practice library. Each one gives you a realistic table, a cell to fill, and a hint if you get stuck. Read them here, then solve them in the interactive grid, where your formula is checked the moment you press Enter.
New to the function? Read the Text functions (LEFT, RIGHT, MID, LEN) guide first: syntax, a worked example and the mistakes people make.
In this set
- Pull a 2-letter prefix from a code
- Pull a 3-digit suffix from a code
- Pull a segment out of the middle
- Count a ticket ID's characters
- Find where a word starts inside a description
The exercises
Product codes start with a 2-letter country prefix. Extract just the prefix from "US-4471".
| A | B | |
|---|---|---|
| 1 | Code | Prefix |
| 2 | US-4471 | ? |
Enter a formula in B2.
Show a hint
LEFT(text, num_chars) returns the first N characters: =LEFT(A2,2).
LEFT is the go-to for peeling a fixed-width prefix, like country codes, account-type flags, or year stamps.
Invoice numbers end in a 3-digit sequence. Extract just that suffix from "INV-2291".
| A | B | |
|---|---|---|
| 1 | Code | Suffix |
| 2 | INV-2291 | ? |
Enter a formula in B2.
Show a hint
RIGHT(text, num_chars) returns the last N characters: =RIGHT(A2,3).
RIGHT mirrors LEFT exactly: same idea, counting from the other end.
Extract just the 4-digit number from the middle of "US-4471-A".
| A | B | |
|---|---|---|
| 1 | Code | Number |
| 2 | US-4471-A | ? |
Enter a formula in B2.
Show a hint
MID(text, start_position, num_chars) counts characters from 1: "US-" is 3 characters, so the number starts at position 4: =MID(A2,4,4).
MID is the one to reach for when what you need isn't at either end of the text.
Find out how many characters are in the ticket ID "TCK-88231".
| A | B | |
|---|---|---|
| 1 | Ticket ID | Length |
| 2 | TCK-88231 | ? |
Enter a formula in B2.
Show a hint
LEN(text) takes no second argument, just the text: =LEN(A2).
LEN is how you validate data: flagging IDs, codes, or phone numbers that are the wrong length.
Find the character position where "Pro" starts inside "Laptop Pro 14-inch".
| A | B | |
|---|---|---|
| 1 | Description | Position of "Pro" |
| 2 | Laptop Pro 14-inch | ? |
Enter a formula in B2.
Show a hint
SEARCH(find_text, within_text) returns a position, not the text itself: =SEARCH("Pro",A2).
SEARCH is how formulas detect whether one piece of text contains another. It's case-insensitive, unlike FIND.
Solve these in a real grid
Type your formula, get graded instantly. Your first 10 exercises are free, no signup.
Start the Text functions (LEFT, RIGHT, MID, LEN) exercises →