=LEN(text)
- text - The text for which to calculate length.
Using the LEN function
The LEN function returns the number of characters in a given text string. LEN takes just one argument, text. LEN counts the number of characters in text, including space and punctuation, and returns a number as the result. If text is an empty string ("") or text is a reference to an empty cell, LEN returns zero. LEN will also count characters in numbers, but number formatting is not included.
Examples
LEN returns the count of characters in a text string:
=LEN("apple") // returns 5
Space characters are included in the count:
=LEN("apple ") // returns 6
LEN also works with numeric values, but number formatting is not included:
=LEN(1000) // returns 4
=LEN($1,000) // returns 4
The LEN function often appears in other formulas that manipulate text in some way. For example, it can be used with the RIGHT and FIND functions to extract text to the right of a given character:
=RIGHT(A1,LEN(A1)-FIND(char,A1)) // get text to right of char
FIND returns the position of the character, which is subtracted from length, calculated with LEN. RIGHT returns the text to the right of that position. Full explanation here.
Notes
- LEN returns the length of text as a number.
- LEN works with numbers, but number formatting is not included.
- LEN returns zero if a value is empty.
- LEN counts an emoji as one character in a Version 2 workbook and two in a Version 1 workbook (see Technical Notes).
Technical Notes
How LEN counts an emoji depends on the workbook's compatibility version, a setting saved with each workbook at Formulas > Calculation Options > Compatibility Version. In Version 2, LEN counts the emoji 🙂 (U+1F642) as one character:
=LEN("🙂") // returns 1 in Version 2
In Version 1, LEN returns the number of UTF-16 code units rather than characters. Emoji and other characters beyond the Basic Multilingual Plane (U+0000 to U+FFFF) take two code units, so LEN returns two:
=LEN("🙂") // returns 2 in Version 1
New workbooks in Excel 365 (Current Channel) have used Version 2 since April 2026. Older workbooks stay on Version 1 until you change the setting, and Excel 2024 and earlier support only Version 1. Version 2 makes the same change to MID, FIND, SEARCH, and REPLACE. LEFT and RIGHT count an emoji as one character in both versions:
=LEFT("😊😐🙁",1) // returns 😊
=RIGHT("😊😐🙁",2) // returns 😐🙁
Letters and most symbols, like π (U+03C0) and ✓ (U+2713), count as one character in either version:
=LEN("π") // returns 1
Some emoji are built from more than one character, and LEN counts each part even in Version 2. A thumbs-up with a skin tone is two characters (U+1F44D and U+1F3FD), and the red heart ❤️ is a heart symbol (U+2764) plus a variation selector (U+FE0F):
=LEN("👍🏽") // returns 2 in Version 2
=LEN("❤️") // returns 2
To browse and search emoji by category, see Emoji Wizard.