MIDB function
MIDB extracts characters from the middle of a text string, working in bytes so each double-byte character counts as two. It differs from MID only in East Asian language settings.
Example
A
B
C
D
1
bcd
2
3
Syntax
MIDB(text, start_num, num_bytes)
-
text(required) - The text to extract from.
-
start_num(required) - Byte position to start at.
-
num_bytes(required) - How many bytes to take.
Returns: The extracted substring, measured in bytes.
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 |
|---|---|---|
=MIDB("Excel",2,3) | xce | Single-byte text |
=MIDB("日本語",3,2) | 語 | Double-byte text |
Watch out for
- Same as MID in non-double-byte settings.
Where it works
- Excel
- MIDB 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 MID.
Part of Text functions. Every result on this page was measured in desktop Excel, build 16.0.20527. Last updated .