Excel’s LEN Function: Basic Knowledge You Need to Know About LEN Function
Hello everyone, to count the length of characters or strings in Excel, we will use the LEN function. Besides counting the number of characters in a string, how can we apply and combine the LEN function to fully exploit its power? Please follow the article below.
WHAT IS THE LEN FUNCTION?
The LEN function in Excel counts all characters in a cell and returns the length of the string. The structure of the LEN function is very simple as follows:
=LEN(Text)
Where Text is the place where you want to count the number of characters.
To understand more, let’s enter some basic commands into Excel as follows:
=LEN(“abc”): The result will return 3, because the text string here is abc and it consists of 3 characters. Note that because they are letters, we must enter them in double quotes.
Similarly, if we try to enter =LEN(11256), the result returned will be 5.
Or we can refer to another cell by entering =LEN(A1).
Now we will go into some applications of the LEN function for calculation.
COUNT CHARACTERS IN MULTIPLE CELLS
Suppose we want to count the total number of characters in cells A1, B1, C1, then we use the LEN function as follows:
=LEN(A1)+LEN(B1)+LEN(C1)
Or we can use the SUM function combined with the LEN function to count, and the formula will be implemented as follows:
=SUM(LEN(A1),LEN(B1),LEN(C1))
Note that the LEN function will also count the spaces, as you can see in this example where there is a space between the numbers. The result returned will be 7, including the space character.
Now if we want to exclude counting this space, we will do it in two cases:
Count characters by removing leading and trailing spaces.
Very simple, you will combine with the TRIM function to count with the syntax as follows:
=LEN(TRIM(A1))
Count characters by removing all spaces in the entire string.
Combining with the SUBSTITUTE function, we get:
=LEN(SUBSTITUTE(A1,” “,””))
So I have just introduced some tips and tricks with the LEN function in Excel, hoping it will be useful to you. Good luck!