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.

LENB is not really about visible text length. It is about storage-style length under older encoding rules. In the few situations where byte size still matters, comparing LENB and LEN can help explain why two strings that look similar may behave differently in older systems or imported files.

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(A1) // Returns 5
Check Answer
Challenge #1
Target: Sheet1!B1

In cell B1, count bytes in A1.

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(A2) // Returns 6 in a DBCS-style setup
Check Answer
Challenge #2
Target: Sheet1!B2

In cell B2, count bytes in A2.

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(A3)-LEN(A3) // Returns the byte difference
Check Answer
Challenge #3
Target: Sheet1!B3

In cell B3, compare LEN and LENB for A3.

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(A4)>LEN(A4),"DBCS Found","Standard")
Check Answer
Challenge #4
Target: Sheet1!B4

In cell B4, check whether A4 uses more bytes than characters and show a label for multi-byte text.

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

LENB is the byte-count version of LEN, so it is mostly useful when an older workflow cares about storage bytes instead of visible character count. This lesson showed that it can return a bigger number than LEN when the text includes double-byte characters.

The practical rule is simple: if you are doing normal modern Excel text work, use LEN. If you are maintaining a legacy file or checking a byte-limited field, LENB can still matter. The difference only becomes important when bytes, not characters, are the real limit.

  • 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
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.