Excel Functions Tutorials
- TEXT Functions in Excel
- Char Function In Excel
- CLEAN Excel Function
- CODE Excel Function
- Concatenate Excel Function
- CONCATENATE Formula in Excel
- Concatenate Date in Excel
- Concatenate Excel Columns
- Concatenate Strings in Excel
- Opposite of Concatenate in Excel
- EXACT Excel Function
- FIND Function in Excel
- LEFT Function in Excel
- LEN in Excel
- MID in Excel
- MID Formula in Excel
- PROPER in Excel
- Proper Formula in Excel
- REPT Function in Excel
- RIGHT Function in Excel
- Right Formula in Excel
- Search Function in Excel
- Substitute Function in Excel
- Substring in Excel
- TEXT Function in Excel
- TEXT Formula in Excel
- Trim in Excel
- Trim Formula in Excel
- VALUE Function in Excel
- Value Formula in Excel
- Financial Functions in Excel (17+)
- Logical Functions in Excel (15+)
- Lookup Reference in Excel (44+)
- Maths Functions in Excel (52+)
- Date and Time Function in Excel (22+)
- Statistical Function in Excel (50+)
- Information Functions in Excel (5+)
- Excel Charts (48+)
- Excel Tools (98+)
- Excel Tips (178+)
- VBA (162+)
MID Excel Function (Table of Contents)
MID in Excel
MID function is categories as text function in excel used to extract the substring from the middle of a string. MID in excel returns a specific number of characters or substring from a string based on the starting point and number of characters specified by you.
In simple words, MID Function in Excel is used to extract a small part of the string from the input string or return a required number of characters from text or string.
MID Formula in Excel and Explanation
MID formula in excel has three compulsory parameters i.e. text, start_num, num_chars.
- text: it is text from which you want to extract the substring.
- start_num: the starting position of the substring.
- num_chars: the numbers of characters of the substring.
How to Use MID Function in Excel?
MID in Excel is very simple and easy to use. Let understand the working of MID function in Excel by some MID Formula example. The MID function can be used as a worksheet function and as VBA function.
MID in Excel as worksheet function.
MID in Excel Example #1
In this MID Formula example we are fetching the substring from the given text string by using the MID formula in excel =MID(B3,2,5) it will fetch the substring from 2 character and 5 letters from 2nd position and output will be as shown in the second column.
MID in Excel Example #2
We can use the mid function the extract the first name and last name from the full name.
For First Name: here we have used the MID formula in excel =MID(B17,1,SEARCH(” “,B17,1)), In this MID Formula example, MID function searches the string at B17 and start the substring from the first character, here search function fetch the location of space and return the integer value. At the end both function filter out the first name.
For the Last Name: similarly for the last name use the =MID(B17,SEARCH(” “,B17),100) and it will give you the last name from the full name.
MID in Excel Example #3
Suppose we have to find out the Block from ID which was located after “-“ in ID then use =MID(H3,FIND(“-“,H3)+1,2) MID formula in Excel to filter out the block ID two character after “-“.
MID in Excel Example #4
We can also find out the domain name from the web URLs. Here is the mid function used to achieve this
Excel MID Function can be used as a VBA function.
Dim Midstring As String
Midstring = Application.worksheetfunction.mid(“Alphabet”, 5, 2)
Msgbox(Midstring) // Return the substring “ab” from string “Alphabet” in the message box.
The output will be “ab”.
Things to Remember About the MID Function in Excel
- Excel MID function returns empty text if the start_num is greater than the length of the string.
=MID(B3,21,5)= blank as the start number is greater than the string length so the output will be blank as shown below.
- If start_num is < the length of text, but start_num + num_chars exceeds the length of string then MID returns the characters up to the end of text.
- MID function excel through the #VALUE! Error
- If start_num < 1 ex. =MID(B3,-1,15)
- If num_chars is negative value.
MID Excel Function Video
This has been a guide to MID Function in Excel. Here we discuss the MID Formula in Excel and how to use MID Excel function along with MID Formula example and downloadable excel templates. You may also look at these useful functions in excel –