# Excel Count Characters in a Cell: LEN Function Guide
> Count characters in an Excel cell with LEN, spaces included. Fix inflated counts with TRIM, count one letter or symbol, and total a whole range.

- Web page: https://logicexcel.com/functions/len-function
- Language: en
- Also in: [Deutsch](https://logicexcel.com/de/functions/len-function.md), [Español](https://logicexcel.com/es/functions/len-function.md)
- Updated: 2026-11-03
- Practice this in the browser: https://logicexcel.com/practice/13

To count characters in an Excel cell, type `=LEN(B2)`. LEN counts every character, including letters, digits, punctuation and spaces, so a cell holding "Enamel mug" returns 10. If stray spaces make the count too high, wrap the cell in TRIM first. To count one particular letter or symbol, subtract the length of the text with that letter removed.

This page works through each of those jobs on one small shop-listing sheet: the plain count, spaces that inflate it, a single letter, a whole column, a character limit, a word count, and the COUNTIF questions people mix up with LEN.

## TL;DR

- `=LEN(B2)` returns the number of characters in B2, and spaces count as characters.
- Counts look wrong when a cell has leading, trailing or doubled spaces. `=LEN(TRIM(B2))` gives the length after cleanup.
- To count one letter or symbol, use `=LEN(B2)-LEN(SUBSTITUTE(B2,"o",""))`. It is case sensitive, so wrap the text in LOWER when case should not matter.
- To total characters across a range, use `=SUMPRODUCT(LEN(B2:B7))`, which works in every version.
- COUNTIF counts cells, not characters. Use it with `?` wildcards to count cells of an exact length.
- LEN counts a number as the text Excel would show for it with no formatting, so a price of 24.5 has length 4 and a date has length 5.

## Table of Contents

- [Sample data used on this page](#sample-data-used-on-this-page)
- [LEN syntax](#len-syntax)
- [How to count characters in a cell in Excel](#how-to-count-characters-in-a-cell-in-excel)
- [Why the character count looks wrong](#why-the-character-count-looks-wrong)
- [Count one letter or symbol in a cell](#count-one-letter-or-symbol-in-a-cell)
- [Count the characters in a whole range](#count-the-characters-in-a-whole-range)
- [COUNTIF characters in Excel](#countif-characters-in-excel)
- [Check a title against a character limit](#check-a-title-against-a-character-limit)
- [Count words with LEN](#count-words-with-len)
- [LEN compared with its alternatives](#len-compared-with-its-alternatives)
- [Excel versions that have LEN](#excel-versions-that-have-len)
- [LEN errors and their fixes](#len-errors-and-their-fixes)
- [What learners get wrong](#what-learners-get-wrong)
- [Worked scenario: audit a column of listing titles](#worked-scenario-audit-a-column-of-listing-titles)
- [Practice LEN with the lessons](#practice-len-with-the-lessons)
- [FAQ](#faq)
- [Sources](#sources)

## Sample data used on this page

Every example below uses this sheet, an online shop's listing export. Row 1 holds the headers. The title in B4 ends with a space, and B5 has two spaces between "Walnut" and "cutting". You cannot see either in the table, which is exactly why they cause trouble. Column C holds real numbers and column D holds real dates.

| Row | A (SKU) | B (Listing title) | C (Price) | D (Listed) |
|---|---|---|---|---|
| 2 | CD-101 | Hand-poured cedar soy candle | 24.5 | 2026-10-12 |
| 3 | CD-102 | Ceramic pour-over coffee dripper, white | 38 | 2026-10-13 |
| 4 | CD-103 | Linen apron, adjustable straps (trailing space) | 19.99 | 2026-10-14 |
| 5 | CD-14 | Walnut  cutting board (two spaces) | 55 | 2026-10-20 |
| 6 | CD-105 | Beeswax food wraps, set of 3, assorted prints, eco | 12 | 2026-10-27 |
| 7 | CD-106 | Enamel mug | 9 | 2026-11-02 |

The notes in brackets in rows 4 and 5 describe the cell and are not part of it.

## LEN syntax

```
=LEN(text)
```

| Argument | Required? | What it does |
|---|---|---|
| text | Required | The text to measure. Usually a cell reference, but it can be text in quotes or the result of another formula. |

LEN takes exactly one argument. There is no option for ignoring spaces or counting only letters, which is why the rest of this page builds those behaviors from LEN plus TRIM and SUBSTITUTE. A blank cell returns 0, as in `=LEN(E2)` on a column you have not filled.

## How to count characters in a cell in Excel

Click an empty cell, type `=LEN(B2)` and press Enter. On the sample sheet that returns 28, the length of "Hand-poured cedar soy candle". Excel counts the hyphen, the three spaces and every letter.

Fill the formula down the column and you get one count per row: one cell in, one number out.

Three details save you from surprises:

1. The formula does not care about fonts, bold, or how wide the column is. It reads the stored value.
2. A number is measured as plain text without formatting. `=LEN(C2)` returns 4 for the price 24.5, even if the cell is formatted as currency and displays R 24.50 or $24.50. `=LEN(C4)` returns 5 for 19.99.
3. A date is a serial number underneath. `=LEN(D2)` returns 5, because the date 12 October 2026 is stored as a five-digit serial. If you want the length of the date as you see it, convert it first: `=LEN(TEXT(D2,"yyyy-mm-dd"))` returns 10.

## Why the character count looks wrong

When LEN returns a bigger number than the characters you can see, the cell almost always has extra spaces. They arrive with pasted web text, exports from other systems and copy and paste from PDFs.

`=LEN(B4)` returns 31, but "Linen apron, adjustable straps" has 30 visible characters. The 31st is the trailing space. `=LEN(TRIM(B4))` returns 30.

Doubled spaces work the same way. `=LEN(B5)` returns 21, while `=LEN(TRIM(B5))` returns 20, because TRIM collapses the two spaces between "Walnut" and "cutting" into one.

TRIM does two things: it removes leading and trailing spaces, and it reduces runs of spaces between words to a single space. It does not remove other whitespace. A non-breaking space, which web pages often use, is character code 160 and survives TRIM. If LEN(TRIM(...)) is still too high, try `SUBSTITUTE(B2,UNICHAR(160)," ")` before the TRIM. The [TRIM guide](https://logicexcel.com/functions/trim) covers that case, and the [SUBSTITUTE guide](https://logicexcel.com/functions/substitute) explains the replacement function used above.

Line breaks inside a cell also count. A line break inside a cell (Alt+Enter on Windows) is one character, code 10, and LEN includes it.

## Count one letter or symbol in a cell

LEN cannot count a single letter directly. The standard trick is to measure the text before and after removing that letter. The difference is the number of times it appeared.

```
=LEN(B3)-LEN(SUBSTITUTE(B3,"o",""))
```

In B3, "Ceramic pour-over coffee dripper, white", the formula returns 3: one o in "pour", one in "over" and one in "coffee". Excel removes every o, measures what is left, and the gap between the two lengths is the count. Counting by eye is how people get this wrong, which is the reason to let the formula do it.

SUBSTITUTE is case sensitive, so capital letters are not counted when you search for a lowercase one. In B2, "Hand-poured cedar soy candle" starts with a capital H. `=LEN(B2)-LEN(SUBSTITUTE(B2,"h",""))` returns 0, and the h you can see is a capital. To count both cases, lowercase the text first: `=LEN(B2)-LEN(SUBSTITUTE(LOWER(B2),"h",""))` returns 1.

Swap the letter for any symbol:

- Commas in B6: `=LEN(B6)-LEN(SUBSTITUTE(B6,",",""))` returns 3.
- Commas and spaces together in B6: `=LEN(B6)-LEN(SUBSTITUTE(SUBSTITUTE(B6,",","")," ",""))` returns 11, since there are 3 commas and 8 spaces.

If the thing you are counting is longer than one character, such as a word, divide by its length. Counting "wraps" in a cell would be `=(LEN(B6)-LEN(SUBSTITUTE(B6,"wraps","")))/LEN("wraps")`.

## Count the characters in a whole range

For the total across B2:B7, use SUMPRODUCT:

```
=SUMPRODUCT(LEN(B2:B7))
```

It returns 179, the sum of 28, 39, 31, 21, 50 and 10. SUMPRODUCT evaluates LEN for every cell in the range and adds the results, and it needs no special key press in any version of Excel.

In Microsoft 365, Excel 2021 and Excel 2024, `=SUM(LEN(B2:B7))` gives the same 179 because those versions evaluate arrays natively. In Excel 2019 and earlier, SUM(LEN(...)) needs Ctrl+Shift+Enter, or it returns a wrong value. SUMPRODUCT avoids the whole question, so it is the safer one to teach. The [array formulas tutorial](https://logicexcel.com/tutorials/array-formulas) explains why.

You can also count how many cells exceed a length: `=SUMPRODUCT(--(LEN(B2:B7)>40))` returns 1, the Beeswax title. The double minus turns TRUE and FALSE into 1 and 0 so SUMPRODUCT can add them.

## COUNTIF characters in Excel

COUNTIF does not count letters or characters. It counts cells that meet a condition. It becomes useful for character questions when you pair it with wildcards, which match text patterns. A question mark matches exactly one character, and an asterisk matches any run of characters, including none.

- `=COUNTIF(A2:A7,"??????")` counts SKUs that are exactly six characters long. It returns 5, because CD-14 in A5 has only five.
- `=COUNTIF(B2:B7,"*candle*")` counts titles that contain the word "candle" anywhere. It returns 1.

Use COUNTIF when you want the number of cells. Use LEN with SUMPRODUCT when you want the number of characters, or the number of times one character appears. The [COUNTIF guide](https://logicexcel.com/functions/countif) and the [wildcard characters guide](https://logicexcel.com/functions/wildcard-characters) cover the matching rules in full.

One limit worth knowing: COUNTIF cannot say "longer than 40 characters" by itself. You would need 41 question marks followed by an asterisk, which is clumsy. `=SUMPRODUCT(--(LEN(B2:B7)>40))` is the better tool for that.

## Check a title against a character limit

Marketplaces and ad platforms cap title length, so a flag column helps. Suppose the limit is 40 characters:

```
=IF(LEN(TRIM(B6))>40,"Too long","OK")
```

For B6 the result is "Too long", since the title has 50 characters. For B3, `=IF(LEN(TRIM(B3))>40,"Too long","OK")` returns "OK" with 39 characters, one under the limit.

Wrapping the cell in TRIM matters. Some platforms trim spaces on upload, so measuring the trimmed text predicts what they will actually count. Fill the formula down, then filter the flag column for "Too long".

## Count words with LEN

Excel has no word-count function, but LEN gives you one. A text with n words has n minus 1 spaces between them, so count the spaces and add 1:

```
=LEN(TRIM(B2))-LEN(SUBSTITUTE(TRIM(B2)," ",""))+1
```

For B2 that returns 4. The TRIM protects the count. Without it, B5 would report four words because of the double space. With it, `=LEN(TRIM(B5))-LEN(SUBSTITUTE(TRIM(B5)," ",""))+1` returns 3, and B6 returns 9.

One edge case: an empty cell returns 1 from this formula, because 0 minus 0 plus 1 is 1. If your column can contain blanks, wrap it: `=IF(LEN(TRIM(B2))=0,0,LEN(TRIM(B2))-LEN(SUBSTITUTE(TRIM(B2)," ",""))+1)`.

## LEN compared with its alternatives

| You want to | Use | Notes |
|---|---|---|
| Characters in one cell | `=LEN(B2)` | Spaces count. |
| Characters after cleanup | `=LEN(TRIM(B2))` | Collapses runs of spaces. |
| Times one letter appears | LEN with SUBSTITUTE | Case sensitive unless you use LOWER. |
| Total characters in a range | `=SUMPRODUCT(LEN(B2:B7))` | Works in every version. |
| Cells of an exact length | COUNTIF with `?` wildcards | Counts cells, not characters. |
| Cells that contain a word | COUNTIF with `*` wildcards | Not case sensitive. |
| Bytes instead of characters | LENB | Microsoft marks it deprecated. |

LENB exists for double-byte languages, where it counts two bytes per character. Microsoft now marks it as deprecated, so use LEN. For the sibling functions that pull text out instead of measuring it, see [LEFT](https://logicexcel.com/functions/left-function), [MID](https://logicexcel.com/functions/mid-function) and the [LEN, LEFT, RIGHT, MID overview](https://logicexcel.com/functions/len-left-right-mid).

## Excel versions that have LEN

LEN has been in Excel from its earliest versions. Microsoft's page lists it for Microsoft 365 on Windows and Mac, Excel 2024, 2021, 2019 and 2016. It is also available in Excel for the web.

Two version notes matter in practice. First, whole-range formulas such as `=SUM(LEN(B2:B7))` only calculate correctly without Ctrl+Shift+Enter in the dynamic-array versions (Microsoft 365, 2021 and 2024). Second, an emoji is stored as two UTF-16 code units, so LEN counts one emoji as 2. Microsoft documents a Compatibility Version 2 setting under which LEN counts such a pair as one character, but variation selectors are still counted separately.

## LEN errors and their fixes

| What you see | Cause | Fix |
|---|---|---|
| `#N/A` from `=LEN(VLOOKUP("CD-999",A2:C7,2,FALSE))` | The lookup failed and LEN passes its error through | Wrap it: `=IFERROR(LEN(VLOOKUP("CD-999",A2:C7,2,FALSE)),0)` returns 0 |
| `#NAME?` | The function name is misspelled, such as LENN | Retype the name and let autocomplete finish it |
| `#VALUE!` from a range in Excel 2019 or earlier | A range was passed where a single cell was expected, and it does not line up with the formula's row | Use SUMPRODUCT, or point at one cell |
| A count that is too high | Leading, trailing or doubled spaces, or a non-breaking space | Use TRIM, and SUBSTITUTE for UNICHAR(160) |
| A count that does not match what the cell displays | The cell shows a formatted value, such as a currency or custom format, but LEN reads the stored one | Click the cell and read the formula bar, or use TEXT to measure the displayed form |
| Formula rejected on entry | Too many arguments, as in `LEN(B2,3)` | LEN takes one argument only |

There is also a ceiling. A cell can hold at most 32,767 characters, so LEN never returns more than that.

## What learners get wrong

Between 26 September and 3 November 2026, learners made 7,811 first attempts across our [LEN, LEFT, and RIGHT Functions lesson](https://logicexcel.com/practice/13), and 63.4% were right. These are first attempts, meaning the first check of a screen in a page view, not a head count of people.

The LEN screen asks what `=LEN(A2)` would return, with a reminder not to forget the space. It drew 822 first attempts and 52.9% were right, so nearly half missed it. Three patterns show up among the most common wrong answers.

1. **Typing the formula instead of the result.** The single most common wrong answer, at 136 first attempts, was `=len(a2)`. The screen asks what the formula returns, so the answer is the number 12, not the formula. A related slip, with 19 attempts, was `len(a2)` with no equals sign, which Excel would read as text.
2. **Typing the name instead of the count.** 84 first attempts typed `mikejohnson` and 50 typed `mike`. LEN returns a number, not the text it measured. The cell holds a first name, a space and a last name, and LEN counts the space: Mike Johnson is 4 letters, 1 space and 7 letters, which is 12.
3. **An extra argument.** 10 first attempts typed `=len(a2,4)`. LEN accepts one argument, so a second one makes Excel refuse the formula.

The correct form is `=LEN(A2)`, and with the name Mike Johnson in A2 it returns 12.

Our mixed practice lesson, [LEN, LEFT, RIGHT, MID Practice](https://logicexcel.com/practice/62), saw 974 first attempts in the same window, with 85.2% right.

## Worked scenario: audit a column of listing titles

You have been asked to prepare the sample export for upload to a marketplace with a 40-character title limit, and to report how many titles need editing.

1. Add a header "Length" in E1. In E2 type `=LEN(TRIM(B2))` and fill down to E7. You get 28, 39, 30, 20, 50 and 10.
2. Add a header "Status" in F1. In F2 type `=IF(LEN(TRIM(B2))>40,"Too long","OK")` and fill down. Only row 6 says "Too long".
3. Count the problem titles with `=SUMPRODUCT(--(LEN(TRIM(B2:B7))>40))`. The answer is 1.
4. Check how close the others are. The title in B3 uses 39 of 40 characters, so it passes with a single character spare. Anyone editing it should know.
5. Find the damage from spaces. Compare `=LEN(B4)` with `=LEN(TRIM(B4))`, 31 against 30. If the upload tool does not trim, the trailing space would count against the limit.
6. Report: one title over the limit, one with a single character to spare, and two cells with stray spaces to clean before upload.

Because the checks use TRIM, the report reflects what the platform will most likely see, not how the raw cells happen to be typed.

## Practice LEN with the lessons

Reading about a formula does not make it stick. Open [Lesson 13, LEN, LEFT, and RIGHT Functions](https://logicexcel.com/practice/13) and type the formulas yourself, then move to [Lesson 62, LEN, LEFT, RIGHT, MID Practice](https://logicexcel.com/practice/62) for mixed questions. Type `=LEN(` into the interactive exercise above this section before you scroll back up.

After that, the [text functions guide](https://logicexcel.com/functions/text-functions) shows where LEN fits among the other text tools.

## FAQ

### How do I count characters in an Excel cell?

Type `=LEN(B2)` in an empty cell, replacing B2 with the cell you want to measure, and press Enter. Excel returns the number of characters, with spaces counted. Fill the formula down to measure a whole column, one result per row.

### Does LEN count spaces in Excel?

Yes. Every space, including leading, trailing and doubled ones, counts as a character. To count the text without the extra spaces, use `=LEN(TRIM(B2))`, which removes leading and trailing spaces and collapses repeated spaces between words to one. To ignore all spaces, remove them with SUBSTITUTE first.

### How do I count a specific letter in an Excel cell?

Subtract the length of the text with the letter removed from the original length: `=LEN(B3)-LEN(SUBSTITUTE(B3,"o",""))`. SUBSTITUTE is case sensitive, so use `LOWER(B3)` inside it and a lowercase letter if capitals should count too. The same pattern counts commas, hyphens or any other symbol.

### Can COUNTIF count characters in Excel?

Not directly. COUNTIF counts cells that match a condition. With wildcards it can count cells of an exact length, such as `=COUNTIF(A2:A7,"??????")` for six-character SKUs. To count the characters themselves, or occurrences of one letter, use LEN, usually inside SUMPRODUCT.

### How do I count the total characters in a range?

Use `=SUMPRODUCT(LEN(B2:B7))`. It measures each cell and adds the results, and it works in every Excel version. In Microsoft 365, Excel 2021 and Excel 2024, `=SUM(LEN(B2:B7))` also works. In older versions that one needs Ctrl+Shift+Enter.

### Why is LEN higher than the characters I can see?

Hidden characters are counted. Common culprits are trailing spaces, doubled spaces, non-breaking spaces from web pages, and line breaks. Run `=LEN(TRIM(B2))` to remove ordinary extra spaces, and use SUBSTITUTE with UNICHAR(160) for non-breaking ones. Compare the two numbers to see how many characters were hidden.

### What is the maximum LEN can return?

32,767. That is the most characters a single Excel cell can hold, and LEN cannot report more than the cell contains. Very long text pasted into a cell beyond that limit is cut off before LEN ever sees it.

## Sources

- [LEN function, Microsoft Support](https://support.microsoft.com/en-us/office/len-lenb-functions-29236f94-cedc-429d-affd-b5e33d2c67cb)
- [LEFT function, Microsoft Support](https://support.microsoft.com/en-us/office/left-leftb-functions-9203d2d2-7960-479b-84c6-1ea52b99640c)
