X
Excel Zero to Hero Interactive Learning Platform
0%
text

LEN Function

beginner

LEN Function

🎯Purpose

Returns the number of characters in a text string, including all spaces (leading, trailing, and internal) and punctuation.

Syntax

EXCEL
=LEN(text)

Arguments Breakdown

Argument Required? Description
text Required The text whose length you want to find. Spaces count as characters.

Practical Examples

1. Character Length Drill

From Formulas_&_Functions_Part_1.xlsx: If A1 contains "Mostafa " (7 letters + 1 trailing space):

EXCEL
=LEN(A1)

Result: 8. Whereas after trimming:

EXCEL
=LEN(TRIM(A1))

Result: 7.

2. Detecting Dirty Leading/Trailing Spaces

EXCEL
=IF(LEN(A2) <> LEN(TRIM(A2)), "Dirty Spaces Detected", "Clean")

3. Data Validation Check

Enforcing national ID or phone number digit length:

EXCEL
=LEN(Customer[Phone]) = 11

Related Knowledge

← Back to Formula Library