LEFTB function
LEFTB returns the first characters of a text string, counting bytes so each double-byte character uses two. It differs from LEFT only when an East Asian language is enabled.
Example
A
B
C
D
1
Ex
2
3
Syntax
LEFTB(text, [num_bytes])
Arguments in [square brackets] are optional.
-
text(required) - The text to take bytes from.
-
num_bytes(optional) - How many bytes to return; default 1.
Returns: The first bytes' worth of characters.
What Excel actually returns
Each formula below was run in desktop Excel. The result is exactly what the cell showed, errors included.
| Formula | Excel shows | Case |
|---|---|---|
=LEFTB("Excel",2) | Ex | Single-byte text |
=LEFTB("日本語",2) | 日本 | Double-byte text |
Watch out for
- Same as LEFT in non-double-byte settings.
- Can cut a double-byte character off if the count lands mid-character.
Where it works
- Excel
- LEFTB is in every version of Excel from 2007 on. Differs from the non-B version only in East Asian (double-byte) language settings.
- Google Sheets
- No direct equivalent. Use LEFT.
Part of Text functions. Every result on this page was measured in desktop Excel, build 16.0.20527. Last updated .