Practice / Text

Extract the serial from a product code (MID)

Easy Text

Warehouse labels use one fixed format, PRD-1023-A: three letters, a dash, a four-digit serial, another dash, and a suffix letter. The packing report only needs the serial — characters 5 through 8. Fill Serial in 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

MID(text, start_num, num_chars) returns num_chars characters beginning at start_num. The first character is position 1, not 0. In PRD-1023-A the serial occupies characters 5 through 8: MID("PRD-1023-A", 5, 4) is "1023". A hardcoded 1023 fails as soon as the code in A2 changes.

Function guide

FAQ

How do I extract the middle of a cell in Excel?

Use =MID(A2, 5, 4). It starts at character 5 and returns the next 4 characters. MID("PRD-1023-A", 5, 4) is "1023".

Does MID count from 0 or from 1?

From 1. The first character is position 1. MID(A2, 0, 4) returns #VALUE!.

Why did I get 0050 instead of 50?

MID returns text, so the leading zero in ACC-0050-C stays. Wrap the result in VALUE only when you need a number.