How do I use the LEN and LENB functions in Excel?

How do I use the LEN and LENB functions in Excel?

The LEN and LENB functions are useful tools in Microsoft Excel that can be used to determine the number of characters in a cell or in a text string. The LEN function counts the number of characters in a cell, while the LENB function counts the number of bytes used to represent the characters. This is particularly helpful when working with non-English or double-byte character languages. To use these functions, simply enter the cell or text string as the argument within the function. The result will be a numerical value representing the number of characters or bytes. These functions are commonly used in data analysis, text processing, and data validation tasks in Excel.

This article describes the formula syntax and usage of the LEN and LENB functions in Microsoft Excel.

Description

LEN returns the number of characters in a text string.

LENB returns the number of bytes used to represent the characters in a text string.

Important: 

  • These functions may not be available in all languages.

  • LENB counts 2 bytes per character only when a DBCS language is set as the default language. Otherwise LENB behaves the same as LEN, counting 1 byte per character.

The languages that support DBCS include Japanese, Chinese (Simplified), Chinese (Traditional), and Korean.

Syntax

LEN(text)

LENB(text)

The xxx function syntax has the following arguments:

  • Text    Required. The text whose length you want to find. Spaces count as characters.

Example

Copy the example data in the following table, and paste it in cell A1 of a new Excel worksheet. For formulas to show results, select them, press F2, and then press Enter. If you need to, you can adjust the column widths to see all the data.

Data

Phoenix, AZ

Formula

=LEN(B1)

=LEN(B2)

=LEN(B3)

Description

Length of the first string

Length of the second string

Length of the third string, which includes eight spaces

     One   

Result

11

0

11

Cite this article

stats writer (2024). How do I use the LEN and LENB functions in Excel?. PSYCHOLOGICAL SCALES. Retrieved from https://scales.arabpsychology.com/stats/how-do-i-use-the-len-and-lenb-functions-in-excel/

stats writer. "How do I use the LEN and LENB functions in Excel?." PSYCHOLOGICAL SCALES, 30 Jun. 2024, https://scales.arabpsychology.com/stats/how-do-i-use-the-len-and-lenb-functions-in-excel/.

stats writer. "How do I use the LEN and LENB functions in Excel?." PSYCHOLOGICAL SCALES, 2024. https://scales.arabpsychology.com/stats/how-do-i-use-the-len-and-lenb-functions-in-excel/.

stats writer (2024) 'How do I use the LEN and LENB functions in Excel?', PSYCHOLOGICAL SCALES. Available at: https://scales.arabpsychology.com/stats/how-do-i-use-the-len-and-lenb-functions-in-excel/.

[1] stats writer, "How do I use the LEN and LENB functions in Excel?," PSYCHOLOGICAL SCALES, vol. X, no. Y, ص Z-Z, June, 2024.

stats writer. How do I use the LEN and LENB functions in Excel?. PSYCHOLOGICAL SCALES. 2024;vol(issue):pages.

Download Post (.PDF)
Slide Up
x
PDF
Scroll to Top