Excel practice · Text Functions

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

  1. Pull a 2-letter prefix from a code
  2. Pull a 3-digit suffix from a code
  3. Pull a segment out of the middle
  4. Count a ticket ID's characters
  5. Find where a word starts inside a description

The exercises

1. Pull a 2-letter prefix from a code Medium

Product codes start with a 2-letter country prefix. Extract just the prefix from "US-4471".

AB
1CodePrefix
2US-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.

2. Pull a 3-digit suffix from a code Medium

Invoice numbers end in a 3-digit sequence. Extract just that suffix from "INV-2291".

AB
1CodeSuffix
2INV-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.

3. Pull a segment out of the middle Medium

Extract just the 4-digit number from the middle of "US-4471-A".

AB
1CodeNumber
2US-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.

4. Count a ticket ID's characters Medium

Find out how many characters are in the ticket ID "TCK-88231".

AB
1Ticket IDLength
2TCK-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.

5. Find where a word starts inside a description Medium

Find the character position where "Pro" starts inside "Laptop Pro 14-inch".

AB
1DescriptionPosition of "Pro"
2Laptop 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 →

More text functions practice

All Excel practice exercises · Excel test prep