Practice / Text

Extract a category code (LEFT)

Easy Text

Your inventory sheet packs everything into one product code like PRD-1023: the first three letters are the category, the rest is the serial. Before you can build a category filter, the report needs a separate Category code column. Fill C2:C5 from the codes in A2:A5.

Your solution should use cell references so it updates automatically when Test Case input values change.

Hints 0/4
Solutions 2
–
Test case
1
2
3
Reset
Submit
fx
A
B
C
D
E
F
G
1
2
3
4
5
6
7
8
9
10
Loading interactive spreadsheet...
Preparing grid cells and formula calculation engine
○ Ready Enter formula in highlighted cells, then click Submit.

Notes

LEFT(text, n) returns the first n characters. The dash is character 4, so a 3-letter prefix stops right before it. If codes had variable prefix lengths, MID + SEARCH would be the more robust pattern.

FAQ

How do I extract the first few characters of a cell?

Use =LEFT(A2, 3) to take the first 3 characters of A2. Replace 3 with however many characters your prefix needs.

What if prefixes have different lengths?

Stop at the delimiter instead: =LEFT(A2, SEARCH("-", A2) - 1) returns everything before the first dash, whatever its position.

Does LEFT change the original column?

No. It returns a new value in the formula cell; the source codes in column A stay untouched.