LENB Function

LENB Function

LENB Function

Returns the number of bytes used by a text string. LENB is mainly a legacy compatibility function for older DBCS workflows.

ExcelClash Team
PUBLISHED

Summary

The Excel LENB function returns the number of bytes used by a text string. That is different from LEN, which counts characters. In older Double-Byte Character Set (DBCS) environments, some characters use more than one byte, so LENB can return a larger value than LEN.

Microsoft now treats LENB as a legacy compatibility function. In current Excel guidance, LEN is the preferred modern function, with updated behavior available through compatibility settings. So LENB is mainly useful when you are working with older spreadsheets or byte-based requirements.

Purpose

Count bytes in text

Returns the storage length of text in bytes rather than the visible character count.

Return Value

A whole number

Returns a numeric byte count such as 5, 6, or 10.

Syntax

=LENB(text)

LENB takes one argument: the text you want to measure in bytes. With plain single-byte text, LENB often matches LEN. With older DBCS-style text handling, the result may be different because one character can use more than one byte.

Arguments

  • text - [Required] The text string, number, or cell reference whose byte length you want to measure.

LENB vs LEN

LEN counts characters. LENB counts bytes. For standard Western text, the two often match. For full-width or DBCS text, LENB may return a larger number.

Sample Text LEN Result LENB Result
"Excel" 5 5
"123" 3 6
"こんにちは" 5 10

Using LENB

LENB appears mostly in older workflows where field limits were measured in bytes instead of visible characters. That can matter in legacy imports, exports, and older systems that expect a fixed byte width.

In modern workbooks, LEN is usually enough. Use LENB only when the requirement is explicitly about bytes, or when you are maintaining an older file that already depends on byte-based logic.

  • Use LENB when a legacy system measures text by bytes.
  • Use LEN when you only care about visible character count.
  • Compare LENB and LEN to spot multi-byte text in older DBCS workflows.

Example 1 - Counting Bytes in Plain Text

With plain text like "Hello", LENB behaves much like LEN. Each character contributes one byte in the older single-byte model.

=LENB("Hello") // Returns 5
Check Answer
Challenge #1
Target: Sheet1!F1
Simple Byte Count

Count bytes in "Excel". Formula: =LENB("Excel").

Example 2 - Counting Bytes in Full-Width Text

Full-width characters may look similar to normal characters, but they can take more storage space. In a byte-based count, that means LENB can return a value that is twice the character count.

=LENB("123") // Returns 6
Check Answer
Challenge #2
Target: Sheet1!F2
Full-Width Count

Count bytes in "Excel". Formula: =LENB("Excel").

Example 3 - Comparing LEN and LENB

Subtracting LEN from LENB is a simple way to see whether the text uses more bytes than characters. If the result is greater than 0, the value likely contains multi-byte characters in that compatibility model.

=LENB(B2)-LEN(B2) // Returns the byte difference
Check Answer
Challenge #3
Target: Sheet1!F3
Compare LEN and LENB

Find whether B2 has a different LEN and LENB. Formula: =LENB(B2)-LEN(B2).

Example 4 - Flagging Multi-Byte Content

You can wrap LENB and LEN inside IF to build a quick flag. This is useful when you need to separate standard single-byte text from values that may cause issues in an older export process.

=IF(LENB(A1)>LEN(A1),"DBCS Found","Standard")
Check Answer
Challenge #4
Target: Sheet1!F4
Check for Multi-Byte Text

Check whether A1 uses more bytes than characters. Formula: =IF(LENB(A1)>LEN(A1),"DBCS Found","Standard").

The main thing to remember is that LENB is no longer the usual choice in modern Excel work. It remains relevant when you are dealing with older byte-based rules, not when you simply want a character count.

Conclusion Recap

  • Summary: LENB counts bytes, not characters.
  • Syntax: =LENB(text).
  • Key point: LENB is mainly a legacy compatibility function.
  • Practical usage: Older DBCS workflows, legacy imports, and byte-limited fields.
  • Best rule: Use LEN for modern character-based work, and LENB only when byte counting is required.
Tactical Arena
Select Scenario:
Share LENB Function!

Tell your friends about this post

Discussion

ExcelClash is an interactive platform designed to level up your Excel skills through real-world exercises and challenges. Sharpen your logic, solve real spreadsheet problems, and learn faster.

© 2026 ExcelClash, Inc. All rights reserved.