LEFT, RIGHT and MID
Part of the Fundamentals section of Coddy's Excel journey — lesson 32 of 42.
Sometimes you only want a piece of a text. Three slicing functions cover every case:
=LEFT(A2,3) first 3 characters
=RIGHT(A2,3) last 3 characters
=MID(A2,5,4) 4 characters, starting at position 5Take the product code EXL-2026-PRO in A2. =LEFT(A2,3) grabs EXL; =RIGHT(A2,3) grabs PRO.
MID is the flexible one, it takes two numbers: where to start and how many to take. Positions are counted from 1: the E is position 1, the X position 2, and the first 2 of the year sits at position 5. So =MID(A2,5,4) returns 2026.
Count carefully, dashes and spaces occupy positions too, exactly like LEN taught you. Slicing never changes the original: A2 keeps the full code, the piece lands where the formula lives.
Challenge
EasyProduct codes follow the shape XXX-YYYY-ZZZ: a 3-letter line, a 4-digit year, a 3-letter tier. The full code sits in A2.
Split it into the labeled columns:
B2, the line: first 3 charactersC2, the year: 4 characters starting at position 5D2, the tier: last 3 characters
A different code (same shape) is tested too, slice with functions, don't retype the pieces.
Try it yourself
| A | B | C | D | E | F | G | |
|---|---|---|---|---|---|---|---|
| 1 | Code | Line | Year | Tier | |||
| 2 | EXL-2026-PRO | ||||||
| 3 | |||||||
| 4 | |||||||
| 5 | |||||||
| 6 | |||||||
| 7 | |||||||
| 8 | |||||||
| 9 | |||||||
| 10 | |||||||
| 11 | |||||||
| 12 | |||||||
| 13 | |||||||
| 14 |
This lesson includes a short quiz. Start the lesson to answer it and track your progress.
All lessons in Fundamentals
1Meet the Spreadsheet
What Is a Spreadsheet?Cells and ReferencesYour First CellsRows, Columns and the GridRecap: Meet the Grid2Entering Data
Text and NumbersBuilding a Small TableEditing and Clearing CellsNumbers That Mean SomethingRecap: Entering Data3Your First Formula
What Is a Formula?Writing a FormulaFormulas with CellsArithmetic OperatorsOrder of OperationsRecap: First Formulas6Working with Text
Joining TextUPPER and LOWERMeasuring Text with LENLEFT, RIGHT and MIDRecap: Working with Text