Excel LEN Function
LEN returns the number of characters in a text value.
Use it to validate code lengths, find unexpectedly long labels, measure generated IDs, or compare text before and after cleanup formulas.
LEN syntax & arguments
Syntax
=LEN(text)
-
1
text
RequiredThe text value, cell reference, or formula result whose character count should be returned.
Example
=LEN(A2)
Return the number of characters in the text from A2.
LEN caveats
-
Spaces count
Leading, trailing, and repeated spaces increase the LEN result. Use TRIM first when ordinary extra spaces should be ignored.
-
Empty text returns zero
A blank cell or
""has a length of 0, which is useful for detecting missing text. -
Formatted numbers can be misleading
LEN counts the underlying value converted to text, not necessarily the number format you see. Use TEXT when the displayed format is what matters.
-
Hidden characters still count
Line breaks or nonprinting characters can make a cell longer than it appears.
Need a length rule? Put LEN inside IF when text should pass only at a specific length, such as =IF(LEN(A2)=8,"Valid","Review").
Intro LEN practice problems
No intro LEN problems are currently available.
Advanced LEN practice problems
Use LEN alongside other Excel functions in realistic, less-prescriptive challenges.