LEN is the Excel function that returns the number of characters in a text string, including spaces, punctuation and digits. You type =LEN("text") or =LEN(A1) and Excel counts every character from the first to the last. There is no built-in function that counts words — LEN counts characters, and counting words requires combining it with functions like TRIM and SUBSTITUTE. That distinction is the single most common misunderstanding about the term, so it is worth settling first: "text length" in Excel means character count, not word count.

What LEN Actually Counts

LEN treats a cell's value as a sequence of characters. Every visible character adds one to the result, and so does every space. A trailing space left over from a copy-and-paste counts too. So does a non-breaking space pasted from a web page, which looks identical to a normal space but is a different character and behaves differently in formulas.

  • Letters and digits: each counts as one. LEN("Excel") returns 5.
  • Spaces: count. LEN("a b") returns 3.
  • Punctuation and symbols: count. LEN("a,b") returns 3.
  • Numbers stored as text: count per digit. LEN("0042") returns 4, but LEN of the number 42 in a cell returns 2, because the leading zeros are not actually stored.
  • Non-printing characters: mostly count. A line break inserted with Alt+Enter in Windows (Option+Return on Mac) counts as one character.
  • Empty cells: return 0. A cell containing only an apostrophe used to force text entry returns 0, because the apostrophe is not part of the value.

LEN's sibling LENB is an older variant intended to count bytes rather than characters. It exists mainly for compatibility with legacy double-byte languages and is rarely the right choice now. In modern Excel, stick with LEN.

How to Use LEN in a Cell

The syntax is deliberately minimal: =LEN(text), where text is a literal string in quotes, a cell reference, or another formula that produces text. There is only one argument, so there is nothing else to get wrong. Some practical patterns:

  1. Select the cell where you want the count.
  2. Type =LEN( then either a quoted string like "hello world" or a reference like A2.
  3. Close the bracket and press Enter. The result is the character count.
  4. Copy the formula down a column to audit every row at once, for example to find free-text notes that exceed a character limit.

If the cell you reference holds a real number or a date rather than text, LEN converts it to its displayed text form before counting. A date will count the characters in Excel's underlying serial representation in some contexts, so if the exact displayed count matters, wrap the reference in TEXT with a format code first. LEN is not case-sensitive and has no optional arguments, so there is nothing to toggle.

Counting Words with LEN

Since LEN counts characters, word counting needs a trick. Words are separated by spaces, so the number of spaces plus one is the number of words in text that has single spaces between words. The classic formula is =LEN(TRIM(A1))-LEN(SUBSTITUTE(TRIM(A1)," ",""))+1 for a non-empty cell. TRIM first collapses runs of spaces to single spaces and removes leading and trailing spaces; SUBSTITUTE then removes every space; subtracting the shortened length from the original gives the number of spaces. Add one and you have the word count.

Two caveats are worth knowing. First, an empty cell breaks this formula, because the plus one yields 1 for a cell with no words. Wrap it in an IF check that returns 0 when the cell is blank. Second, TRIM only removes normal spaces, not non-breaking spaces, so text pasted from a browser can still inflate the count. To handle those, substitute CHAR(160), the non-breaking space character, for a normal space before trimming.

Practical Uses for Text Length

  • Enforcing limits: data validation alone cannot easily cap length against a formula, but LEN in a helper column flagged with conditional formatting gives an instant visual check of entries over a limit — useful for product titles, meta descriptions or SKU notes.
  • Cleaning imported data: compare LEN before and after TRIM to detect stray spaces. If the numbers differ, the cell had padding.
  • Extracting text: LEFT, RIGHT and MID work hand in hand with LEN. To pull everything after a certain character, combine FIND with MID, using LEN to know how many characters remain.
  • Splitting fixed-width codes: if every entry is a fixed length, LEN quickly proves whether any row deviates.
  • Detecting hidden characters: an unexpected count is the fastest hint that a cell contains an invisible character, such as a line break or non-breaking space.

Common Problems and Fixes

The most frequent complaint is that LEN returns a larger number than expected. Nine times out of ten the cell contains a stray space or a non-printing character. Test it with =LEN(TRIM(A1)); if that count is smaller, trim the cells. If it is still too high, check for characters that come from web data: =LEN(SUBSTITUTE(A1,CHAR(160),"")) will show whether non-breaking spaces are the culprit, and Clean can strip other non-printing characters in one pass.

Another frequent surprise is LEN returning an error. That happens when the reference points at an error value, such as #VALUE!, rather than text. LEN does not suppress errors, so the error propagates. Wrap the reference in IFERROR if you want the column to stay tidy.

A third issue involves merged cells and array formulas. LEN applied to a range in a dynamic-array version of Excel spills a result for every cell, which can look like a bug if you expected one answer. Reference a single cell, or use SUMPRODUCT to total lengths across a range.

Finally, be careful with numbers. LEN sees what Excel stores, not what you see on screen. Cell formatting that shows 1,234.50 does not add characters to the underlying value, so LEN returns the length of the stored number's text representation, which may include decimals but not thousands separators.

LEN vs. Other Length Tools

Excel has a few other ways to inspect text, and each does something different. LEN returns a count of characters. LENB returns a count based on bytes. The status bar at the bottom of the window, when a range of text cells is selected and the relevant option is enabled, shows a simple count of selected cells, not characters, so it is not a substitute. Power Query has its own text length transformation for imported tables, and that is the better route if the data will be loaded repeatedly, because the cleaning step then lives in the query rather than in helper columns.

Word processors often show character counts in a status bar, but Excel does not display a running count of the active cell, which is why the function is the everyday tool. In Excel for the web, LEN works the same way as in the desktop app, so formulas can be shared between them. Function labels can differ slightly in other locales, where the function name itself may be translated, but the behaviour does not change.

Frequently Asked Questions

Does LEN count spaces?

Yes. Every space is one character, including leading and trailing spaces and spaces left over from pasted text. That is why comparing LEN with LEN(TRIM()) is a quick way to spot stray spaces.

Does Excel have a word count function?

No. There is no built-in word count. Word counting requires a formula that counts spaces and adds one — the LEN, TRIM and SUBSTITUTE combination described above — with a blank-cell guard if your range may contain empty cells.

Why does LEN give a different answer for numbers?

LEN works on the stored value's text form. A number with trailing zeros in its display format does not keep those zeros, so a cell showing 42.00 may return 2 rather than 5. To count the displayed text, first convert it with TEXT using the format you want.

Is there a limit to the length of text Excel can count?

A formula cannot return a result longer than the cell limit, and there is a limit on the total characters a cell can hold, so LEN itself is not the constraint — the cell is. Very long strings are better handled in Power Query or a database than in a single cell.

Can LEN count characters in a cell across multiple lines?

Yes, but line breaks inserted within a cell count as a character each. If you want the count of visible text without line breaks, substitute the line-break character out first, using CHAR(10) in Windows formulas.