How to Use MIDB Function

The MIDB function returns the bytes you specified based on the starting position and the number of bytes. When a double-byte character set (DBCS, e.g., Japanese, Simplified Chinese, Traditional Chinese, and Korean) is set as the default language, each character will be counted as 2 bytes. Otherwise, MIDB function is the same as MID function.

Formula:

=MIDB(text, start_num, num_bytes)

Explanations:

– Text is required, the text string that you need to extract letters from.

– Start_num is required. The position of the first byte you need to extract. Start_num can be any number, but the result returns blank if the number is larger than the number of bytes in the text string.

– Num_bytes is required, the number of bytes you want to extract.

Cautions:

– Start_num is greater than the length of the text, the result returns blank;

– Start_num is less than 1, the result returns the #VALUE! error;

– Num_bytes is negative, the result returns the #VALUE! error.

Example: Extract the 2 letters from "How to" from the 2nd letter?

=MIDB(A2,2,2)
The result returns the characters "ow".

Download: MIDB Function

Leave a Reply