Home Privacy Policy Feedback Link to us Site Map Forums

Excel: Len Function


In Excel, the Len function returns the length of the specified string.

The syntax for the Len function is:

Len( text )

text is the string to return the length for.


Applies To:

  • Excel 2007, Excel 2003, Excel XP, Excel 2000

For example:

Let's take a look at an example:

Based on the Excel spreadsheet above:

=Len(A1) would return 13
=Len(A2) would return 12
=Len("Excel") would return 5

VBA Code

The Len function can also be used in VBA code. For example:

Dim LResult As Long

LResult = Len ("www.techonthenet.com")

In this example, the variable called LResult would now contain the value 20.