LEN ()
This function counts the number of characters, including
spaces and numbers, in a cell.
Best view in desktop mode.
A
|
B
|
C
|
D
|
|
1
|
Name
|
Length
|
||
2
|
Peter Parker
|
12
|
=LEN(A2)
|
|
3
|
Black Panther
|
13
|
=LEN(A3)
|
|
4
|
Doctor Strange
|
14
|
=LEN(A4)
|
|
5
|
Thanos
|
6
|
=LEN(A5)
|
|
6
|
ABC123
|
6
|
=LEN(A6)
|
|
7
|
Syntax
=LEN(Text)
Formatting
No special
formatting is needed.
Example
This
example shows how the =LEN() function is used in a formula which extracts the second
name from a text entry containing both first and second names.
A
|
B
|
C
|
D
|
|
1
|
Tom Cruise
|
|||
2
|
Value of Space
|
4
|
=FIND(" ",B1)
|
|
3
|
Total Length
|
10
|
=LEN(B1)
|
|
4
|
Total Char in Second Name
|
6
|
=LEN(B1)-FIND("
",B1)
|
|
5
|
Second Name
|
Cruise
|
=RIGHT(B1,LEN(B1)-FIND("
",B1))
|
|
6
|
=LEN(B1) is the total length of the name.
=LEN(B1)-FIND(" ",B1) is the length of the second name. Calculated by taking the
overall length of the complete name and subtracting the position of the space.
=RIGHT(B1,LEN(B1)-FIND(" ",B1)) is just the second name. Calculated
by using the =RIGHT() function to extract the rightmost characters up to the
length of the second name.
No comments:
Post a Comment