LENB
The LENB function returns the length of a string in bytes.
This function can be useful for determining the actual size of text data in bytes, which is important when working with multi-byte encodings where a single character can occupy more than one byte.
Syntax
LENB(string)
| Argument | Description | Permitted values |
|---|---|---|
| string | Text whose length needs to be returned | Text string or reference to a cell containing text |
Examples of use
Calculating the length of the text in cell A1
=LENB(A1)
The result will be equal to the number of bytes occupied by the text in this cell.
Determining the length of a specific text string
=LENB("Hello")
The result will show the number of bytes required to store the word “Hello” (5 bytes).
Notes
- The LENB function takes into account the bytes that may be required to represent characters. This is particularly important if the text contains characters that are larger than one byte.
- If the argument is not text, it will be automatically converted to text before calculation.