LEFT, RIGHT & LEN in Google Sheets
Text functions pull pieces out of codes, IDs and names. =LEFT(A2, 3) returns the first three characters, =RIGHT(A2, 4) the last four, and =MID(A2, 5, 2) two characters starting at position 5.
LEN returns the length of the text, which is useful for validation (is every ID 8 characters?) and for dynamic extraction: =RIGHT(A2, LEN(A2)-4) returns everything after the first four characters.
Syntax
=LEFT(text, n) · =RIGHT(text, n) · =LEN(text)
Example
=LEFT(A2, 3)
The 3-letter prefix of a product code like "ABC-1042".
Common mistakes
- Results are text: "042" from RIGHT won't add up until wrapped in VALUE.
- Hidden spaces make LEN return a bigger number than you expect.
- Counting positions from 0 instead of 1.
← XLOOKUP · Joining text: & and TEXTJOIN → · All lessons