The MIDB function returns a specific number of characters from the middle of a text string, starting at a specified position. It is a versatile tool to extract substrings from larger text strings in Excel.


=MIDB(Text, Start_num, Num_chars)

Text The text string from which characters will be extracted.
Start_num The starting position within the text string to begin extraction.
Num_chars The number of characters to extract from the text string starting from the specified start position.

About MIDB

Imagine you have a long text string and need to extract specific segments from the middle of it. This is where the MIDB function shines in Excel. By providing the original text, the starting position, and the number of characters needed, you can swiftly obtain the desired substring without manual intervention or complex manipulations. Whether you're dealing with product codes, file names, or any other text data, MIDB streamlines the extraction process, saving time and effort in your spreadsheet tasks.


Consider the text string 'ExcelRocks123'. If you want to extract the characters 'Rocks' starting from the 5th position, the MIDB formula would be: =MIDB('ExcelRocks123', 5, 5)

Suppose you have the text 'DataIsFun789' and you need to extract 'Fun' starting from the 7th character. The MIDB formula would be: =MIDB('DataIsFun789', 7, 3)


Can the MIDB function be used to extract text from the beginning or end of a string?

Yes, the MIDB function can extract characters from any position within the text string. By adjusting the Start_num and Num_chars arguments, you can target the desired segment from the middle of the string.

Is the case sensitivity of letters taken into account by the MIDB function?

Yes, the MIDB function is case-sensitive, meaning that it will extract characters exactly as they appear in the text string. Ensure consistency in letter cases when specifying the segment to be extracted.

Can the MIDB function handle non-alphanumeric characters in the text string?

Yes, the MIDB function can handle non-alphanumeric characters within the text string. It will accurately extract the specified number of characters starting from the designated position, regardless of the character type.

Related functions