LEN Function in Google Sheets
Returns the number of characters in a string. Used for validation, truncation logic, and detecting unexpectedly long or short values.
Syntax
LEN(text)Returns: The character count of text.
Excel equivalent: LEN (identical)
Parameters
| Name | Required | Description |
|---|---|---|
| text | Required | The string to measure. |
Examples
Validate input length
=IF(LEN(A2) > 50, "Too long", "OK")Flags values longer than 50 characters.
Find blank-looking cells
=FILTER(A:A, ARRAYFORMULA(LEN(TRIM(A:A))) = 0)Returns cells that contain only whitespace or are truly empty after trimming.
Truncate display with ellipsis
=IF(LEN(A2) > 30, LEFT(A2, 27) & "...", A2)Caps the displayed length at 30, replacing the last 3 chars with an ellipsis.
When to use an alternative
- ISBLANK — You only want to test for truly empty cells.
Common errors and how to fix them
LEN returns 0 for visually blank cells
Cause: Cell appears empty but has an empty-string formula result.
Fix: Combine LEN(TRIM(...)) to ignore whitespace-only content.
Related functions
Frequently Asked Questions
How does LEN handle unicode characters?
LEN counts code points, not bytes. "héllo" is 5 characters. Emoji that use multiple code points (compound emoji like flags) may count as more than 1 — usually 2.
Why is LEN of a cell with a formula 0?
If the formula returns an empty string (=""), LEN counts zero characters. If you want to detect this case, wrap with IF(LEN(A2)>0, ...). For truly-empty detection use ISBLANK.