LEN Function in Excel

LEN returns the number of characters in a text string, including spaces.

1 min read · Updated 17 Oct 2026 · By Md. Saiful Islam · বাংলায় পড়ুন

What is the LEN Function

The LEN function returns the number of characters in a text string, including spaces. It is useful for validating input length, detecting trailing spaces, and parsing variable-length text.

Formula: =LEN(text)

Practical Example 1

A2 contains Hello World.

Type: =LEN(A2)

Result: 11

Practical Example 2

Detect leading or trailing spaces.

Type: =LEN(A2) <> LEN(TRIM(A2))

Result: TRUE if extra spaces exist

Practical Example 3

Validate a phone number length.

Type: =IF(LEN(A2)=11, Valid, Invalid)

Result: Valid or Invalid

Practical Example 4

Combine LEN with RIGHT to extract variable-length suffixes.

Type: =RIGHT(A2, LEN(A2) - FIND(-, A2))

Result: the text after the dash

When to Use It

LEN is used for validating input length, for detecting trailing spaces, for parsing variable-length text, for checking data quality, and for any formula where the number of characters matters.

Get one practical IE tip every week

Join IE and production professionals learning with in2eff.