MIDB

Description

MIDB returns the specified number of bytes from a text string, beginning with the specified starting position.

Syntax

MIDB ( text, start_position, num_chars )

 

Parameter

Description

text

The string from which to return bytes.

start_position

The position of the first byte to return from text.

 

If start_position is 1, the first byte in text is returned.

If start_position is greater than the number of bytes in text, an empty string (" ") is returned.

If start_position is less than 1, #VALUE! is returned.

num_chars

The number of bytes to return. If num_chars is negative, #VALUE! Is returned.

Remarks

If start_position plus the number of bytes in num_chars exceeds the length of text, the bytes from start_position to the end of text are returned.

Examples

This function returns Expenses:

MIDB("Travel Expenses", 8, 8)

This function returns 45:

MIDB("Part #45-7234", 7, 2)

With Latin letters, one letter is one byte. That is why MID and MIDB are identical.

 Note:

If an Invalid formula syntax warning appears, check whether the comma is set as the list separator in your regional settings on the Windows Control Panel. If a different character is set as the list separator, use this character in the above examples in place of the comma. (Windows XP: Access the Windows Control Panel and select Regional and Language Options. On the Regional Options tab page, click Customize. On the Numbers tab page, check which character is the default list separator on your computer. Use this character in the above examples instead of the comma.

Also, see

MID

LEFTB

LEFT

RIGHT

RIGHTB

SEARCH