Excel Character Count: Use the LEN Formula

Formulas & functions · Updated November 18, 2026

To count characters in an Excel cell, use the LEN function: if the text is in A2, enter =LEN(A2) in another cell. LEN returns the number of characters in the cell’s value, including spaces and punctuation, so it is the standard formula for an Excel character count.

What the LEN formula counts

LEN counts the characters in the text supplied to it. That includes letters, digits represented as text, punctuation, and spaces at the beginning, between words, or at the end. It counts what is in the cell’s value, not how wide the cell is or how many characters are visibly displayed in the grid.

For example, suppose A2 contains the text Northwind. Enter =LEN(A2) in B2, and B2 returns 9. If A2 contains red blue, the result is 8: seven letters plus the space. A blank cell returns 0, as does a formula whose result is an empty text string.

LEN also works with a text value written directly into a formula. For example, =LEN("Excel 365") returns 9: five letters, one space, and three digits. In normal use, a cell reference is more convenient because the result updates when the source value changes.

How to count characters in Excel

In Excel for Microsoft 365 on Windows, select the cell where you want the answer, type the LEN formula, and press Enter. Replace A2 with the address of the cell you want to check. To apply the same check to many rows, fill or copy the formula down beside the data.

  1. Put the text to check in a cell, such as A2.
  2. In B2, enter =LEN(A2).
  3. Press Enter to see the count.
  4. Copy B2 down to count the text in the other rows.

For instance, if A2 contains customer names and B2 contains the formula, B2 shows the character count for the name in A2. If you later edit that name, Excel recalculates the count automatically. The same formula works in Excel for Mac and Excel for the web; the basic steps do not differ.

Spaces, punctuation, and visible text

A frequent surprise is that LEN includes spaces. A name with a space between first and last names has one more character than the same letters without the space. Leading and trailing spaces count too, even when they are difficult to notice in a worksheet. Punctuation, hyphens, apostrophes, and symbols also count as characters.

To count characters while excluding ordinary spaces, subtract the length of the text after SUBSTITUTE removes spaces. If A2 contains red blue, enter =LEN(A2)-LEN(SUBSTITUTE(A2," ","")); the result is 7, because the original text has 8 characters and one ordinary space is removed for the second count.

This formula removes the standard space character, not every character that might look like a space. A nonbreaking space copied from a website, for example, is a different character and will remain. Also, this calculation counts all non-space characters; it does not trim or otherwise clean the text.

Count a particular character or symbol

You can adapt the same length-difference method to count occurrences of one character. The idea is to compare the original text length with the length after removing that character. With the word cheese in A2, enter =LEN(A2)-LEN(SUBSTITUTE(A2,"e","")); the result is 3 because cheese has three e characters.

SUBSTITUTE is case-sensitive, so that example counts lowercase e but not uppercase E. To count both cases, normalize the text to one case before comparing. With the text in A2, =LEN(LOWER(A2))-LEN(SUBSTITUTE(LOWER(A2),"e","")) counts either case of e. The formula changes a temporary copy of the text for counting; it does not change the contents of A2.

This method is useful for checking delimiters, punctuation, or repeated markers in imported data. For a multi-character string, the length difference reflects the total number of removed characters, so divide by the search string’s length if you need the number of non-overlapping occurrences. Be aware that SUBSTITUTE removes matching text as a whole and does not count overlapping matches.

Count the characters in a formula

LEN(A2) counts the value in A2, not the characters in the formula typed into A2. If A2 contains a formula and you want to measure the formula text itself, FORMULATEXT can return that formula as text for LEN to count. For example, if A2 contains =SUM(1,2), enter =LEN(FORMULATEXT(A2)) in B2. The result is 10, counting the equals sign, function name, parentheses, digits, and comma.

FORMULATEXT requires a cell that contains a formula; it is not a way to count the displayed result of that formula. If A2 contains a typed value rather than a formula, FORMULATEXT cannot return a formula string for it. For the calculated result, use LEN(A2) instead. This distinction matters when a cell displays a short answer produced by a long formula: those are two different things to count.

Numbers, dates, and formatted cells

LEN is primarily a text-counting function, but Excel can convert numeric values to text when evaluating it. The count then reflects the value’s text representation, not necessarily the way the number appears after number formatting. A date formatted to display as a long date, for example, is stored as a numeric date value; LEN does not simply count the visible month name and date shown in the cell.

If you need to count the characters in a particular display format, first create text in that format with TEXT, then count that text. For example, if A2 contains a date and you want a month/day/year string, use =LEN(TEXT(A2,"mm/dd/yyyy")). For a valid date, the formatted text has 10 characters. Choose a format that matches the output you actually need; a different format can produce a different count.

Formatting such as font, color, column width, or a custom number format does not add characters to the underlying cell value. Likewise, a narrow column may show hash marks for a number, but those marks are a display limitation, not characters that LEN counts.

Unicode, emoji, and line breaks

Most ordinary letters, digits, and punctuation count as one character each. Some symbols and emoji are represented internally using more than one Unicode code unit. In current Excel, LEN generally counts a supplementary Unicode character such as many emoji as one character when the workbook uses Excel’s newer compatibility behavior. Workbooks using older compatibility behavior can count some such symbols as two. Therefore, an emoji count may differ from what a website or another program calls a character.

Unicode also includes combining marks. A letter followed by a separate accent mark may look like one visible symbol while being represented by more than one code point. The result depends on how the text is encoded and Excel’s compatibility behavior; LEN is not a general-purpose tool for counting what a person perceives as visual symbols. If a spreadsheet must match an external system’s exact character rules, test representative accented text, emoji, and symbols in that same system.

Line breaks inside a cell count as characters too. They can be inserted with Alt+Enter in Excel for Windows; on Mac, the shortcut differs by keyboard and Excel version, so use the platform’s in-cell line-break shortcut. A cell with text on two lines therefore includes the line-break character in its LEN result, even though that break is not a printed letter or symbol.

Common reasons a count looks wrong

When the result seems unexpectedly high, inspect the source for extra spaces, line breaks, or characters pasted from a webpage. A cell can contain characters that are invisible or visually similar to ordinary spaces. You can click the cell and inspect its contents in the formula bar, or compare the count before and after cleaning the source data.

When the result seems too low, check whether you are counting the displayed result or the formula itself, and whether some characters are part of a combined Unicode sequence. A blank-looking cell may also contain a formula returning an empty string; LEN returns 0 for that result even though the cell is not literally empty.

  • Check for leading or trailing spaces, which LEN includes.
  • Confirm the formula points to the intended cell and row.
  • Remember that number formatting changes appearance, not the underlying value LEN evaluates.
  • Test emoji and unusual symbols separately if an external character limit is involved.

For a simple check of whether a cell exceeds a limit, compare LEN with the required maximum. If A2 holds the text and the limit is 20 characters, enter =LEN(A2)>20 in B2. The result is TRUE only when A2 has more than 20 characters; a value of exactly 20 returns FALSE. This can support validation or review, but it does not automatically shorten or edit the original text.

Excel’s cell limit and external limits

An Excel cell can contain up to 32,767 characters, and a worksheet cell displays only a portion of that content directly in the grid. LEN can help inspect long text within Excel, but a destination such as a web form, database field, or messaging service may have a different limit or counting convention. Some services count bytes, Unicode code points, or grapheme clusters rather than characters the way Excel does.

Before relying on a LEN result for an upload or form submission, check the destination’s stated rules. If it imposes a limit, test examples containing spaces, accented letters, line breaks, and emoji. A formula gives a repeatable count under Excel’s rules; it cannot guarantee that a separate application will interpret every symbol the same way.

Frequently Asked Questions

What is the Excel formula to count characters?
Use =LEN(A2) when the text is in A2. It counts letters, numbers in the text, spaces, punctuation, and other characters in the value.

Does LEN count spaces?
Yes. LEN counts ordinary spaces, including leading, trailing, and between-word spaces. To exclude ordinary spaces, subtract the length after SUBSTITUTE removes them.

How do I count characters without spaces?
If the text is in A2, use =LEN(A2)-LEN(SUBSTITUTE(A2," ","")). This excludes ordinary spaces only; other whitespace-like characters may still be counted.

Does LEN count a blank cell or a formula returning nothing?
Both produce a count of 0. A formula returning an empty text string is not the same as a truly empty cell for every Excel operation, but LEN returns zero for either case.

Does LEN count emoji as one character?
Usually in current Excel compatibility behavior, many emoji count as one, but older workbook compatibility behavior and complex Unicode sequences can produce different results. Check the specific symbols if an exact external limit matters.

Can I count the formula instead of its result?
Yes, for a cell containing a formula, use =LEN(FORMULATEXT(A2)). Use =LEN(A2) when you want to count the cell’s value or displayed text result instead.

Related

Try it: the Formula Explainer: paste any formula and see each function and reference in plain English.

More in Formulas & functions

Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources

Spotted an error in this guide? Let us know.