# LEN function in Excel

> LEN counts the characters in a text string, including spaces and punctuation.

Source: https://spreadsheetpractice.com/functions/len · Updated October 28, 2026 · Formulas and results on this page were run by the Spreadsheet Practice formula engine on November 20, 2026

## Quick answer

- **What it does:** LEN counts the characters in a text string, including spaces and punctuation.
- **Syntax:** `=LEN(text)`
- **Most common use:** `=LEN(A2)` returns 10 (The trailing space counts: 10 characters, not 9)
- **Available in:** Every current version
- **Category:** [Text functions](https://spreadsheetpractice.com/functions/category/text)
- **Returns:** A number: the count of characters. An empty cell returns 0.
- **Google Sheets:** Works the same in Google Sheets.

## What it does

LEN counts the characters in a text string, including spaces and punctuation. It's the measuring tape behind most text formulas: checking that IDs are the right length, finding stray spaces, and working out how many characters to keep with LEFT, RIGHT or MID.

## Syntax

`=LEN(text)`

| Argument | Required? | What it is |
|---|---|---|
| `text` | Required | The text or cell to measure. Numbers are counted as stored, without formatting. |

## Examples

Each result was calculated by running the formula on the sample sheet.

| Cell | Formula | Result | What it shows |
|---|---|---|---|
| D2 | `=LEN(A2)` | 10 | The trailing space counts: 10 characters, not 9 |
| D3 | `=LEN(B3)=5` | FALSE | TRUE only for a five-digit ZIP; this one is a digit short |
| D4 | `=280-LEN(C4)` | 252 | Characters left under a 280-character limit |

### The sample sheet

Every formula above runs on this data:

|  | A | B | C | D |
|---|---|---|---|---|
| 1 | Name | ZIP | Post | Result |
| 2 | Maya Chen | 55409 | Launching our spring line today! | 10 |
| 3 | Raj Patel | 5541 | Sale ends Friday | FALSE |
| 4 | Lee Wong | 55416-2207 | New store hours start Monday | 252 |

## Common mistakes

| What you see | Why, and how to fix it |
|---|---|
| The count is one or two too high | Hidden leading or trailing spaces count. Compare LEN(A2) with LEN(TRIM(A2)); if they differ, the cell has extra spaces. |
| Formatted numbers count short | LEN counts the stored value, so $1,250.00 stored as 1250 returns 4. Use LEN(TEXT(A2,"$#,##0.00")) to count what you see. |
| A range gives several answers | =LEN(A2:A10) returns one length per cell, which spills in Microsoft 365. To total the characters in a range, use =SUMPRODUCT(LEN(A2:A10)). |

## Tips

- Count how many times a character appears: =LEN(A2)-LEN(SUBSTITUTE(A2,",","")) counts the commas.
- Cap a field's length with data validation using a custom rule such as =LEN(A2)<=50.

## Related functions

- [TRIM](https://spreadsheetpractice.com/functions/trim): TRIM removes spaces from the start and end of text and shrinks runs of spaces between words to one.
- [LEFT](https://spreadsheetpractice.com/functions/left): LEFT returns a set number of characters from the start of a text string.
- [SUBSTITUTE](https://spreadsheetpractice.com/functions/substitute): SUBSTITUTE replaces specific text with new text everywhere it appears, or only at the occurrence you choose.

## Questions

### Does LEN count spaces?

Yes. Every space counts, including leading and trailing ones you can't see, which makes LEN a quick way to spot messy imports.

### How do I count words in a cell?

Count the spaces in the trimmed text and add one: =LEN(TRIM(A2))-LEN(SUBSTITUTE(TRIM(A2)," ",""))+1. An empty cell returns 1 with this formula, so wrap it in IF if blanks are possible.

## Practice

A graded LEN exercise ("Check ID lengths") is on [the LEN page](https://spreadsheetpractice.com/functions/len). It is checked instantly, then re-checked on changed data.

Lessons that use LEN:

- [Lesson 18: LEFT, RIGHT, MID & LEN](https://spreadsheetpractice.com/learn/left-right-mid-len) (Pro)

---

Spreadsheet Practice (https://spreadsheetpractice.com) teaches spreadsheet formulas by practice: every exercise is graded in a live grid and re-checked on changed data.
