To find the length of text in an Excel cell, use the LEN function. It returns the number of characters, including spaces and punctuation, in a selected cell. No add-ins or special tools are needed—this works in all modern versions of Excel on Windows, Mac, and Excel Online.

What You'll Need

  • Microsoft Excel (2010 or later) on Windows, Mac, or Excel Online
  • A cell containing text you want to measure
  • Access to a blank cell to display the result

Step-by-Step

  1. Open your Excel workbook and locate the cell with the text you want to measure. For example, suppose the text is in cell A2.
  2. Click on a blank cell where you want the length to appear—this will be your output cell. It can be anywhere in the sheet, even on a different sheet.
  3. Type the formula =LEN(A2) into that cell. Replace A2 with the actual reference to your target cell. Always use uppercase for the function name—len will not work.
  4. Press Enter. Excel will immediately display a number representing the total characters in the referenced cell, including spaces and line breaks.
  5. To measure multiple cells at once, drag the fill handle (small square at the bottom-right corner of the selected cell) down or across to copy the formula to adjacent cells. Excel will automatically adjust the cell references (e.g., A3, A4, etc.).
  6. If your text includes line breaks created with Alt+Enter, each break counts as one character. To verify this, select the source cell and check the formula bar—it will show line breaks as small arrows.
  7. For text stored as numbers or dates, LEN still counts the displayed characters. For example, if a cell displays "12/25/2023" but is formatted as a date, LEN returns 10, not the underlying serial number.

Common Mistakes

  • Using LEN on blank cells without checking: if the cell is empty, LEN returns 0, which is correct—but if you expected text, it may mean the cell contains a formula returning blank.
  • Forgetting to use cell references: typing =LEN("Hello") works, but if you want to measure dynamic content, always reference a cell instead of hardcoding text.
  • Not accounting for leading or trailing spaces: cells copied from web pages or external sources often have invisible spaces. LEN counts them, so use TRIM first if you want to exclude them: =LEN(TRIM(A2)).
  • Assuming LEN counts words: it counts characters, not words. Use =LEN(TRIM(A2))-LEN(SUBSTITUTE(A2," ",""))+1 to estimate word count.
  • Using the wrong case: len (lowercase) does not work in Excel. Always use LEN.

Tips

  • Combine LEN with TRIM to clean data: =LEN(TRIM(A2)) removes extra spaces before counting, giving you cleaner metrics for form validation or data entry rules.
  • Use LEN with IF to enforce limits: =IF(LEN(A2)>50,"Too long","OK") can flag entries exceeding character limits.
  • For conditional formatting, select a range, go to Home > Conditional Formatting > New Rule > Use a formula, then enter =LEN(A2)>100 to highlight long entries.
  • LEN counts Unicode characters as one each, so emojis, accented letters, and symbols like © or € all count as one character.
  • To count only letters and numbers, combine LEN with SUBSTITUTE to remove punctuation: =LEN(SUBSTITUTE(SUBSTITUTE(A2," ",""),".","")) removes spaces and periods, but this only works for specific cases.
  • Check for non-printing characters with CODE or FIND functions if LEN returns unexpectedly high numbers—sometimes hidden characters like tabs or paragraph marks are present.

Troubleshooting

  • Formula shows #NAME?: This means Excel doesn’t recognize "LEN". Double-check spelling. Ensure you’re not using a non-English version of Excel—some languages use "LÄNGE" or similar. Switch your Excel language to English or use the local function name.
  • Result is 0 but cell looks full: The cell may contain a formula returning an empty string (e.g., =""). Select the cell and look at the formula bar. If it shows a formula, not text, you’re measuring the output of that formula.
  • LEN counts too many or too few characters: Press F2 while the source cell is selected to edit it. Look for invisible characters in the formula bar. Use the CLEAN function: =LEN(CLEAN(A2)) removes non-printable characters like line feeds or tabs from imported data.
  • Formula doesn’t copy properly: If dragging the fill handle doesn’t update references, check if the cells are locked or if you’re in manual calculation mode. Go to Formulas > Calculation Options and ensure it’s set to Automatic.
  • LEN returns a decimal: This is impossible. LEN always returns an integer. If you see a decimal, someone may have formatted the result cell as a number with decimals—change the cell format to General.

Frequently Asked Questions

Can LEN count characters in merged cells?

No. LEN only counts text in the top-left cell of a merged range. Merged cells are treated as a single unit for display, but the formula only reads the primary cell where the data is stored.

Does LEN include spaces?

Yes. Every space, tab, or line break counts as one character. If you need to exclude spaces, wrap the cell reference in TRIM: =LEN(TRIM(A2)).

Can I use LEN to count characters across multiple cells?

Not directly. LEN works on one cell at a time. To count across multiple cells, add them: =LEN(A2)+LEN(B2)+LEN(C2).

Why does LEN return 1 for a cell that appears empty?

That cell likely contains a space or non-breaking space (ASCII 160). Use =CODE(LEFT(A2,1)) to check the ASCII value of the first character. If it’s 160, use SUBSTITUTE to replace it before LEN.

Does LEN work with numbers and dates?

Yes. LEN counts the displayed characters. A date formatted as "1/1/2024" returns 8. A number formatted as currency may return 7 for "$1,000".

Can I use LEN in Excel Online?

Yes. The LEN function works identically in Excel Online, Excel for Mac, and Excel for Windows.