How to Use the LEN, LENBs Function in Excel

Today, we’ll explore two closely related functions in Excel and Google Sheets – LEN and LENB. These functions are integral for counting the number of characters in the content of a cell. We’ll delve into their functionalities and practical applications within your spreadsheets.

LEN Function

The LEN function counts the number of characters in a cell, which includes letters, numbers, special characters, and spaces.

The syntax for the LEN function is:

=LEN(text)

Here, text refers to the cell reference or the direct text string whose characters you wish to count.

Example Formula Result
Cell A1 contains: “Hello, World!” =LEN(A1) 13

LENB Function

Exclusive to Excel, the LENB function counts the number of bytes used by the text in a cell. It is particularly useful for texts where each character represents two bytes, commonly seen in double-byte character sets (DBCS).

The syntax for the LENB function is:

=LENB(text)

Here, text refers to either a cell reference or a text string for which the byte count is required.

Example Formula Result
Cell A1 contains: “你好” =LENB(A1) 4

Application of LEN and LENB Functions

Here are some practical ways you can utilize the LEN and LENB functions in your worksheets:

  • Checking Maximum Character Limit: Employ the LEN function to keep track of the character count in a cell and enforce conditional formatting if the content surpasses a predefined threshold.
  • Calculating Average Word Length: You can calculate the average length of the words in a text by dividing the total character count by the number of words, which can be determined using the FIND or SUBSTITUTE functions.
  • Identifying Double-Byte Characters: Use the LENB function to check if a cell contains double-byte characters, which is crucial for handling texts in multiple languages.

Integrating these functions into your Excel or Google Sheets workflows allows for more effective management and analysis of text data, focusing on character and byte counts.

More information: https://support.microsoft.com/en-us/office/len-lenb-functions-29236f94-cedc-429d-affd-b5e33d2c67cb

Other functions
Returns an array of text values from any specified range
Changes full-width (double-byte) English letters or katakana within a character string to half-width (single-byte) characters
Converts a number to text, using the ß (baht) currency format
Returns the character specified by the code number
Removes all nonprintable characters from text
Returns a numeric code for the first character in a text string
Combines the text from multiple ranges and/or strings, but it doesn't provide the delimiter or IgnoreEmpty arguments
Joins several text items into one text item
Changes half-width (single-byte) English letters or katakana within a character string to full-width (double-byte) characters
Converts a number to text, using the $ (dollar) currency format
Checks to see if two text values are identical
Finds one text value within another (case-sensitive)
Formats a number as text with a fixed number of decimals
Changes half-width (single-byte) characters within a string to full-width (double-byte) characters
Returns the leftmost characters from a text value
Converts text to lowercase
Returns a specific number of characters from a text string starting at the position you specify
Converts text to number in a locale-independent manner
Extracts the phonetic (furigana) characters from a text string
Capitalizes the first letter in each word of a text value
Replaces characters within text
Repeats text a given number of times
Returns the rightmost characters from a text value
Finds one text value within another (not case-sensitive)
Substitutes new text for old text in a text string
Converts its arguments to text
Formats a number and converts it to text
Combines the text from multiple ranges and/or strings, and includes a delimiter you specify between each text value that will be combined If the delimiter is an empty text string, this function will effectively concatenate the ranges
Removes spaces from text
Returns the Unicode character that is references by the given numeric value
Returns the number (code point) that corresponds to the first character of the text
Converts text to uppercase
Converts a text argument to a number
Returns text from any specified value