Quick Answer

LEN Function

LEN counts the number of characters in a text string.

✓ Excel✓ Google SheetsExcel All versions

Syntax

LEN
(text)

Parameters

ParameterDescriptionRequired
textThe text string whose length you want to find.Required

Basic Example

Count characters in a string

=LEN("Hello")
Result5

Returns the number of characters in "Hello".

Advanced Examples

Example 1: Check password length

Validation

Verify if a password meets minimum length requirements

=IF(LEN(A1)>=8, "Strong", "Too short")
Result: Strong
Checks if the password has at least 8 characters.

Example 2: Count characters excluding spaces

Text analysis

Count characters in a string without spaces

=LEN(SUBSTITUTE(A1, " ", ""))
Result: 10
Removes all spaces before counting characters.

How LEN Works

LEN counts every character in the text string, including spaces, punctuation, and special characters.

1
Select output cell
Choose where the result should appear.
2
Enter formula
Type =LEN(text).
3
Press Enter
The result shows the character count.

Important Notes & Limitations

  • LEN counts each character as 1, including spaces and special characters.

  • For double-byte languages (like Chinese), use LENB instead.

Common Errors & Fixes

#VALUE!Invalid argument

Fix: Ensure the argument is text or a cell reference.

Download Practice File

Practice LEN with Real Data

Download a sample CSV file with pre-populated data and practice exercises for the LEN function. Works in both Excel and Google Sheets.

Works in Google SheetsCompatible with ExcelIncludes exercises

File format: CSV (comma-separated values) - opens in Excel, Google Sheets, and all spreadsheet apps

Frequently Asked Questions

Does LEN count spaces?
Yes, LEN counts every character including spaces.
What is the difference between LEN and LENB?
LEN counts characters, LENB counts bytes. For double-byte characters, LENB counts 2 bytes per character.