Spreadsheet Practice

How to count characters in a cell in Excel

Formula (Excel and Google Sheets)

=LEN(A2)

Use =LEN(A2). It counts every character, including spaces and punctuation.

Result on the example
one result per row in B2, filled down to B6
Works in
Every current version
Google Sheets
Same formula

See it work

The formula is already in B2, filled down to B6. Change any input and the result updates, or edit the formula to experiment.

How it works

LEN returns the number of characters in the text, spaces included. It's the usual check for limits like a 30-character product title or a 160-character SMS.

=LEN(A2)

Result22

  1. A2"Ergonomic office chair"

    The value in A2.

  2. LEN(A2)22

    LEN: Number of characters.

    • textA2"Ergonomic office chair"

In Google Sheets

The same formula works in Google Sheets: =LEN(A2). We ran it in Google Sheets mode on the same data and it returns the same results.

Other ways to do it

Each one was run on the same example sheet.

FormulaResultWhen to use it
=LEN(TRIM(A2))22, 32, 10…Ignores leading, trailing and repeated spaces.
=LEN(SUBSTITUTE(A2," ",""))20, 29, 9…Different resultCounts characters without any spaces. Spaces are not counted.

Common mistakes

  • LEN counts the characters you see for numbers as stored, not as formatted: LEN of $1,000.00 is 4.
  • To flag titles over the limit, compare with a cell: =IF(LEN(A2)>$E$1,"Too long","OK").

Try it yourself

Same data, empty answer cell. Your formula is graded instantly, then re-checked on changed data, so a typed-in number won't pass.

Count characters in a cell

In B2, count the characters in the product title and fill down to B6.

Questions

How do I count how many times a character appears?

Subtract the length without it: =LEN(A2)-LEN(SUBSTITUTE(A2,"a","")).

How do I count words?

Count the spaces and add one: =LEN(TRIM(A2))-LEN(SUBSTITUTE(A2," ",""))+1.

Checked by running on 2026-10-29: every formula and result on this page was calculated by the Spreadsheet Practice formula engine, in both Excel and Google Sheets modes.