In this post, let’s learn how the LEN Function works in excel, describes the formula syntax, and how you can use the LEN Function in your excel spreadsheet.
What is LEN Function in Excel?
The LEN function in Excel is used to calculate the number of characters in a string. It is a text function in excel, also known as the LENGTH Function in excel.
It counts the letters, numbers, special characters, non-printable characters, and all spaces in an Excel cell.
Syntax of LEN Function
=LEN(text)
Parameter
- Text– length of the text to be calculated.
Example
LEN(A1)
LEN(“Developerpublish.com”)
How to use LEN Function in Excel?
The following steps will explain the work of the LEN function in an excel spreadsheet:
First, prepare an excel sheet with the specified details in it, or open an existing file with data.
Example 1:
In this example, we are going to calculate the length of the string in the column by using the LEN command following the ”=” operator and within the parenthesis declare the address of the cell which to be calculated.
Example 2:
The LEN Function is also used in other functions.
- SUBSTITUTE and LEN Function
This combo is used to calculate the length of the text by eliminating the spaces in the text.
Syntax:=LEN(SUBSTITUTE(A2,” “,””))
- SUM and LEN Function
This combo is used to calculate the length of the characters in different cells.
Syntax: =SUM(LEN(A2),LEN(B2))
LEN Function is also used as VBA Function,
Syntax
LENcount = Application.Worksheetfunction.LEN(“text”)
Note:
- The LEN Function doesn’t calculate the length of the formatted text.
- The length of the empty cell is 0.