The LEN function returns the length of a string in characters.
This function can be useful when you need to accurately determine the number of characters in a text string, including all spaces, punctuation marks, and invisible characters.
Syntax
LEN(string)
Argument |
Description |
Permitted values |
|---|---|---|
string |
String whose length needs to be returned |
Text string or reference to a cell containing text |
Examples of use
Calculating the length of the text in cell
=LEN(A1)
The result will be equal to the number of characters contained in this cell.
Determining the length of a specific text string
=LEN("Hello")
The result will show the number of characters in the word “Hello” (5 characters).
Notes
–The LEN function takes into account all characters, including spaces and special characters.
–If the argument is not text, it will be automatically converted to text before calculation.