SheetsLessons
Lesson 23 · Text

LEN & TRIM

Count characters with LEN and clean up messy spacing with TRIM in Google Sheets. Hands-on practice.

Task 1 of 3

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.

Measuring and cleaning text

=LEN(text)
=TRIM(text)

LEN counts characters, including spaces and punctuation. It's handy for checking limits such as headline or SMS length.

TRIM removes spaces at the start and end and squeezes runs of spaces in the middle down to one. Data pasted from forms, PDFs or other systems often hides extra spaces that break lookups and comparisons. TRIM is the fix.

Functions nest: =LEN(TRIM(A2)) counts characters after cleaning.