Quick Navigation
LEN & LENB Functions
Summary
The Excel LEN function counts characters in a text string, treating each Unicode character as one unit. LENB counts bytes for double-byte character sets (DBCS), but is deprecated in modern Excel versions.
Syntax
LEN(text)
LENB(text)
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| text | Text |
Yes | The text whose length you want to find. Spaces count as characters. |
Using the LEN, LENB Function
LEN is perfect for validating input lengths, creating dynamic formulas based on text size, and text manipulation tasks. LENB exists for backward compatibility with double-byte character sets but should be avoided in new workbooks.
Common LEN, LENB Examples
Basic LEN Examples
=LEN("Phoenix, AZ")
=LEN("One")
=LEN(" ")
Returns 11, 3, and 3 (spaces count).
Dynamic Range with LEN
=LEN(A1)>10
Checks if cell A1 has more than 10 characters.
LENB Legacy Example
=LENB("テキスト")
Counts bytes for DBCS text (deprecated).
Frequently Asked Questions
Common Errors and Solutions
#VALUE!
Cause: Non-text argument provided
Solution: Ensure text parameter contains valid text or wrap with TEXT()
Wrong count for emojis
Cause: Using older Excel without Compatibility Version 2
Solution: Upgrade or use Compatibility Version 2
Notes
- LENB is deprecated - use LEN instead
- In Compatibility Version 2, LEN correctly handles surrogate pairs
- Variation selectors (emojis) count as separate characters
- LEN returns 0 for empty cells
- Numbers are converted to text before counting
Compatibility
Available in: Excel 2007, Excel 2010, Excel 2013, Excel 2016, Excel 2019, Excel 2021, Excel 365
Not available in: Excel 2003 and earlier
Content last reviewed: December 9, 2025
Update frequency: As needed
Excel versions tested: Excel 2007+, Excel 2010+, Excel 2013+, Excel 2016+, Excel 2019+, Excel 365