Excel functions / Text
LEFT, RIGHT & MID
Return characters from the start, end or middle of some text.
Syntax
=LEFT(text, num_chars)
=RIGHT(text, num_chars)
=MID(text, start_num, num_chars)Arguments
text | The text to take characters from. |
|---|---|
num_chars | How many characters to take. |
start_num | For MID: the position of the first character to take. |
How it works
These three cut text into pieces by position. LEFT takes from the start, RIGHT from the end, and MID from any position you choose.
They are perfect for codes with a fixed layout. For "AB-1042", =LEFT(A2,2) gives AB, =RIGHT(A2,4) gives 1042 and =MID(A2,4,2) gives 10.
Example
| A | B | C | |
|---|---|---|---|
| 1 | Code | ||
| 2 | AB-1042 | 10 | |
| 3 | CD-2291 | ||
| 4 |
Result: 10. Two characters, starting at position 4.
Tips
- The results are always text. Wrap them in VALUE to turn digits back into a number.
Practise LEFT, RIGHT & MID
Try it yourself in a real spreadsheet, with instant feedback on every answer.