We have discussed in our Previous Article on how to extract partial text in Excel using LEFT
, LEFTB
and RIGHT
, RIGHTB
functions. In this Article, we will discuss another set of Text Functions in Microsoft Excel for the same purpose; to extract partial text from the given text.
MID
and MIDB
functions
MID
and MIDB
functions are used to get the partial text from the given text. We can get the partial text from anywhere in the text. We need to specify from where we need the text to extract in the given text and number of characters or bytes to extract.
MIDB
version will extract number of bytes; whereas MID
version will extract number of characters.
The Syntax of these functions are:
=MID(text, start_index, num_chars)
=MIDB(text, start_index, num_bytes)
Where text is the given text. start_index tells from where to fetch the partial text. num_chars is the number of character to return from the specified start_index. num_bytes is the number of bytes to return from the specified start_index.
All the arguments are mandatory. And the index starts from the value 1.
Formula | Result |
=MID(“Microsoft Excel”, 1, 9) | Microsoft |
=MID(“Microsoft Excel”, 11, 5) | Excel |
=MID(“Microsoft Excel”, 0, 5) | #VALUE! |
If you specify wrong index value when extracting the text; Excel will through #VALUE! Error.
We will discuss more functions of Excel in my Upcoming Articles.
🙂 Sahida