SheetsLessons
Text function

LEN function in Google Sheets

LEN counts the characters in a piece of text, including spaces and punctuation. Use it to check length limits or as a building block for extracting text.

Syntax

=LEN(text)
text
The text or cell to measure.

Practice LEN

Task 1 of 2

How many characters are in the headline in A2? Answer in B2.

B2
fx

Tip: while typing a formula, click a cell or drag across cells to insert references. Press Enter to check, and Tab to accept a function suggestion.

LEN examples

Each example below runs against this sample sheet. The results are calculated by the same engine as the practice grid.

ABC
1Raw nameSKUNote
2  maya   PATEL ELC-0427-NYRefund requested
3leo rossiFUR-1180-TXShipped
4AVA KIMOFC-0093-CARefund issued
Messy imported data
FormulaResultWhat it shows
=LEN(A2)15Includes all the stray spaces.
=LEN(TRIM(A2))10Length after cleaning up spaces.
=LEN(B2)11SKUs should all be 11 characters.

Tips and common mistakes

  • =LEN(A2) - LEN(TRIM(A2)) tells you how many extra spaces a cell has.
  • Numbers are measured as they'd be written, e.g. LEN(1234) is 4.

Related functions