LEFTB
TheLEFTB
formula is used to extract a specified number of bytes from the beginning of a text string. This formula is similar to the LEFT
formula, but instead of counting characters, it counts bytes. This can be useful when working with languages that use multi-byte characters, such as Chinese or Japanese.
- How to use
LEFTB
formula? - Examples of using
LEFTB
formula LEFTB
formula not working?- Similar formulas to
LEFTB
Usage
Use the LEFTB
formula with the syntax shown below, it has 2 required parameters:
- string (required):
The text string that you want to extract bytes from. - num_of_bytes (required):
The number of bytes that you want to extract from the beginning of the string.
Examples
Here are a few example use cases that explain how to use theLEFTB
formula in Google Sheets.
Extract first character from a string
If you want to extract the first character from a string, you can use the LEFTB
formula with a num_of_bytes
argument of 1.
Extract first two characters from a string
If you want to extract the first two characters from a string, you can use the LEFTB
formula with a num_of_bytes
argument of 2.
Extract first three characters from a string
If you want to extract the first three characters from a string, you can use the LEFTB
formula with a num_of_bytes
argument of 3.
Extract first four characters from a string
If you want to extract the first four characters from a string, you can use the LEFTB
formula with a num_of_bytes
argument of 4.
Extract first five characters from a string
If you want to extract the first five characters from a string, you can use the LEFTB
formula with a num_of_bytes
argument of 5.
Common Mistakes
LEFTB
not working? Here are some common mistakes people make when using the LEFTB
Google Sheets Formula:
Providing a non-numeric value for num_of_bytes
The num_of_bytes
parameter must be a number. Providing a non-numeric value, such as a text string, will result in an error.
Providing a negative value for num_of_bytes
The num_of_bytes
parameter must be a positive number. Providing a negative value will result in an error.
Related Formulas
The following functions are similar to LEFTB
or are often used with it in a formula:
-
LEFT
The
LEFT
formula is used to extract a specific number of characters from the beginning of a text string. It is most commonly used to extract the first name or last name from a full name or to extract a date from a text string. -
MID
The MID formula in Google Sheets is used to extract a specific number of characters from a string, starting at a specified point. This is useful when working with large datasets and you only need a portion of the information in a cell. The formula takes in the string to extract from, the starting point, and the length of characters to extract as arguments.
-
RIGHT
The
RIGHT
formula in Google Sheets returns the rightmost characters from a string, based on the number of characters specified. It is commonly used to extract a certain number of characters from the end of a string. The formula takes two arguments: the string from which to extract the characters, and the number of characters to extract. -
LEN
The
LEN
formula in Google Sheets is used to count the number of characters in a given text string. It is commonly used to check the length of text inputs, or to find the length of a cell value or range. -
FIND
The
FIND
formula in Google Sheets searches for a specific text within another text and returns the position of the first occurrence of the text. This formula is often used to extract a substring from a larger string or to check if a certain text exists within another text.
Learn More
You can learn more about the LEFTB
Google Sheets function on Google Support.