Text
LEFTB Function in Excel
Returns the leftmost characters from a text value based on bytes.
Syntax
- =LEFTB(text, [num_bytes])
Arguments
- text (required): Text string
- num_bytes (optional): Number of bytes to extract
Examples
- =LEFTB(A1, 4) - First 4 bytes - Result: Characters
Excel LEFTB function documentation
- LEFTB returns the first characters from text based on byte count.
- Syntax: =LEFTB(text, [num_bytes]). It is a byte-aware variant of LEFT.
- Use LEFTB when truncation rules are defined by bytes in DBCS environments.
- Text function category: [/categories/text/](/categories/text/).
LEFTB syntax and byte-based extraction
- text is required and num_bytes is optional (defaults to 1 byte).
- In mixed-width strings, returned visible characters may vary by byte composition.
- Use LEFTB with LENB to avoid cutting fields beyond byte limits.
- Always verify outputs visually when multilingual characters are involved.
Step-by-step: create 20-byte prefix key
- Step 1 - Keep original product title in A2.
- Step 2 - In B2 use =LEFTB(A2,20).
- Step 3 - In C2 check byte size with =LENB(B2).
- Step 4 - Use B column as export key where byte restrictions apply.
LEFTB vs LEFT vs MIDB
- LEFTB extracts from start by bytes, useful for DBCS constraints.
- LEFT extracts by character count and is easier for general English datasets.
- MIDB extracts from a byte offset when you need internal byte slices.
- Final labels can be polished with [TEXT](/functions/text/) if required.
Worked examples to copy
- Basic byte extraction: =LEFTB(A2,10).
- Default one-byte extraction: =LEFTB(A2).
- Safe truncation check: =IF(LENB(A2)>20,LEFTB(A2,20),A2).
- Preview + size: =LEFTB(A2,12)&" ("&LENB(LEFTB(A2,12))&")".
People also ask
- LEFTB vs LEFT? - LEFTB uses bytes, LEFT uses characters.
- Why does LEFTB return fewer visible characters? - Double-byte characters consume more bytes.
- Is LEFTB needed in modern Unicode workflows? - Mostly for legacy byte-limited systems.
- Can LEFTB cut a character awkwardly? - Test outputs carefully in multilingual content.
Common errors
- Different from LEFT for double-byte characters
Use cases
- Asian text processing
- Byte-level extraction
- Data parsing
Frequently asked questions
- What is the LEFTB function in Excel? LEFTB returns the leftmost characters from a text value based on bytes. The syntax is =LEFTB(text, [num_bytes]). Typical use cases include asian text processing, byte-level extraction, data parsing.
- How do I use the LEFTB function? To use LEFTB, type =LEFTB( in a cell and provide the required arguments. Excel will show you the syntax and parameter hints as you type. Make sure to close the parentheses and press Enter to execute the function.
- Can LEFTB handle different text formats? Yes, LEFTB can work with various text formats including strings, cell references containing text, and text values returned by other functions. It processes text according to its specific functionality.
- Why is LEFTB not working in my Excel? Common issues with LEFTB include Different from LEFT for double-byte characters. Start by checking the syntax =LEFTB(text, [num_bytes]), then verify each referenced cell or range.
Editorial review
- Reviewed by Excel.Directory Editorial Team. Updated May 2026.
When to use LEFTB
- Asian text processing — common Text scenario for LEFTB.
- Byte-level extraction — common Text scenario for LEFTB.
- Data parsing — common Text scenario for LEFTB.
LEFTB in the Text category
- Browse all Text functions at /categories/text/ for related formulas.
- LEFTB syntax: =LEFTB(text, [num_bytes])
- text (required): Text string
- num_bytes (optional): Number of bytes to extract
- Confirm LEFTB arguments match the syntax shown above before filling down.
- Lock table and range references with $ when copying formulas across rows or sheets.
Formula checklist before you copy down
- Confirm LEFTB arguments match the syntax shown above before filling down.
- Lock table and range references with $ when copying formulas across rows or sheets.
- If results look wrong, check for text stored as numbers and invisible spaces with TRIM.
- Spot-check three known input rows manually against expected output.
Related Excel functions
- LEFT (/functions/left/): Returns the specified number of characters from the start of a text string.
- RIGHTB (/functions/rightb/): Returns the rightmost characters from a text value based on bytes.
- MIDB (/functions/midb/): Returns a specific number of characters from a text string based on bytes.
Errors to watch for
- Different from LEFT for double-byte characters — review causes on linked error pages in the directory.
Copy-paste audit workflow
- Enter LEFTB on three test rows with known expected output documented on a QA tab.
- Fill down only after absolute references are locked on lookup tables and rate tables.
- Compare against manual calculation or a calculator for financial and statistical functions.
- Search this directory for comparison guides when choosing between similar functions in the same category.
LEFTB worked examples to copy
- =LEFTB(A1, 4) — First 4 bytes. Expected result: Characters.
LEFTB reference summary for crawlers and offline review
- LEFTB belongs to the Text category in Excel. Returns the leftmost characters from a text value based on bytes.
- Full syntax: =LEFTB(text, [num_bytes]). Open /functions/leftb/ for parameters, FAQs, and related pages.
- Common mistakes: Different from LEFT for double-byte characters
- Pair this function with comparison guides when another Excel formula might fit the same task better.
- Review fix-excel-formula-errors when unexpected errors appear after upgrading Excel or sharing across locales.