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.

1
Choose text Use a cell, value, or formula result
2
Count its characters Letters, numbers, spaces, and hidden characters count

LEN syntax & arguments

Syntax

=LEN(text)
Required Optional
  1. 1

    text

    Required

    The 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.