← All how-to recipes

How to count characters in a cell

✓ Verified in LibreOffice 25.8.7.3

Character count for a cell — with or without spaces — for limits, validation, or SMS/tweet length.

The formula

AppFormulaNotes
Excel=LEN(A2)Counts everything including spaces. Without spaces: =LEN(SUBSTITUTE(A2," ","")).
Google Sheets=LEN(A2)Identical.
LibreOffice Calc=LEN(A2)Identical.

How it works

LEN returns the total number of characters, spaces and punctuation included — "hello world" is 11. To exclude spaces, remove them first: =LEN(SUBSTITUTE(A2," ","")) gives 10. LEN counts a leading/trailing space too, which is why =LEN(A2)-LEN(TRIM(A2)) is a quick way to detect stray padding. For a whole column's total, wrap in SUMPRODUCT: =SUMPRODUCT(LEN(A2:A100)). (Note LENB counts bytes, which differs from LEN only for double-byte languages.)

Verified, not just documented

We ran =LEN(A2) in LibreOffice 25.8.7.3 (headless, with forced recalculation) and it returned 11 — exactly the expected result. Every formula here is confirmed by actually executing it.