Excel LEN function


The Excel LEN function returns the length of a given text string as the number of characters. LEN will count characters in a string, including letters, numbers, characters, and all spaces.
  • text: The text string for which the length will be returned.
Return value
The number of characters in the text string.

How to use

LEN is widely used in data cleaning, formatting, and analysis tasks in Excel to determine the length of text strings, which can be crucial for data validation, substring extraction, or formatting.


Simple LEN
Counting Characters in a Cell: To find out the number of characters in a cell:
If A1 contains “Hello World”, this formula returns 11.
LEN with Trimming Spaces
Counting Characters Excluding Leading/Trailing Spaces: Combining LEN with TRIM to count characters excluding extra spaces:
If B2 contains ” Excel “, the formula returns 5, ignoring extra spaces.
LEN for Data Validation
Validating Text Length: Using LEN in data validation, such as checking if an entry meets a specific character count:
					=LEN(C2) = 10
This could be used to validate that an input in C2 is exactly 10 characters long.
LEN in String Manipulation
Combining LEN with Other Text Functions: Using LEN in conjunction with RIGHT or LEFT for substring extraction:
					=RIGHT(D2, LEN(D2) - 3)
This formula removes the first 3 characters from the text in D2.
LEN for Dynamic Ranges
Dynamic Range Specification in Formulas: Utilizing LEN to specify dynamic ranges in functions:
					=MID(E2, 3, LEN(E2) - 5)
Extracts a substring from E2, starting from the 3rd character and excluding the last 5 characters.

Additional Notes

  • LEN counts all characters, including spaces, punctuation, and special characters.
  • To ignore leading and trailing spaces in the count, use the TRIM function in combination with LEN.
  • Useful in text analysis, substring functions, and when specific text lengths are required for formatting or processing.

Related Functions

Excel MID function

The Excel MID function extracts a substring from the middle of a text string, based on start position and length, perfect for text manipulation.

Excel RIGHT function

The Excel RIGHT function extracts characters from the end of a text string, ideal for isolating specific data segments.

Excel LEFT function

The Excel LEFT function extracts a specified number of characters from the start of a text string, useful for data parsing.

Content Navigation