How to count characters in a cell
✓ Verified in LibreOffice 25.8.7.3 ✓ Verified in Google Sheets (2026-08-30)Character count for a cell — with or without spaces — for limits, validation, or SMS/tweet length.
The formula
| App | Formula | Notes |
|---|---|---|
| Excel (desktop) | =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. We then ran the same formulas in Google Sheets, executed 2026-08-30: a formula-only workbook goes into Google Drive, which converts it to a Sheet and recalculates every formula with Google’s own engine, and comes back out as .xlsx carrying the values Google computed. It returned 11 for the worked example, the same value LibreOffice produced. Both engines’ numbers on this page are executed results. The Excel formula follows Microsoft’s official documented syntax — we do not run desktop Excel.
Functions used
LEN — see full Excel, Google Sheets & LibreOffice compatibility for each.