# How to count characters in a cell in Excel

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

**Excel:** `=LEN(A2)` (Every current version)

**Google Sheets:** the same formula works.

## Example

Sample data (row 1 is the header):

| A | B | C | D | E |
| --- | --- | --- | --- | --- |
| Product title | Characters |  | Limit | 30 |
| Ergonomic office chair |  |  |  |  |
| Adjustable standing desk, walnut |  |  |  |  |
| USB-C dock |  |  |  |  |
| Noise-cancelling wireless headset |  |  |  |  |
| Desk lamp |  |  |  |  |

Formula in B2, filled to B6: `=LEN(A2)`

Result: 22; 32; 10; 33; 9

## 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.

## Other ways

- `=LEN(TRIM(A2))`: Ignores leading, trailing and repeated spaces.
- `=LEN(SUBSTITUTE(A2," ",""))`: Counts 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")`.

## 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`.

Every formula and result on this page was checked by running it in the Spreadsheet Practice formula engine on 2026-10-29.

Source: https://spreadsheetpractice.com/formulas/count-characters-in-a-cell
