The LEN function returns the number of characters in a supplied text string. LENB returns the number of bytes used to represent the characters in a text string.

Syntax

=LEN(text)

=LENB(text)

Note: LENB counts 2 bytes per character only when a double-byte character set (DBCS) language is set as the default language. Otherwise LENB behaves the same as LEN, counting 1 byte per character.

Arguments

Argument Description
text The text string for which to calculate the length. Spaces count as characters

Note: text can be supplied to the LEN function in any of the following ways:

  • directly
  • as a text string returned from another function or formula
  • as a reference to a cell containing a text string

Examples

  A B C D
1 Text Formula Result Notes
2 Salt Lake City =LEN(A2) 14 Length of “Salt Lake City”
3 Utah =LEN(A3) 4 Length of “Utah”
4 UT =LEN(A4) 2 Length of “UT”
5 01-Jul-2014 =LEN(A5) 5 Date is stored as a 5 digit integer: 41821
6 030 =LEN(A6) 3 Length of “030” (text)
7 32.2 =LEN(A7) 4 Length of a number (32.20)
8 1,000 =LEN(A8) 4 Length of a number (1000)

Usage note: Numbers and dates will return a length, but keep in mind that number formatting is not included; i.e. the length of “100” formatted as “$100.00” is still 3.