Excel Functions Tutorials
- Excel Formulas Cheatsheet
- Financial Functions in Excel
- Logical Functions in Excel
- TEXT Functions in Excel
- Lookup Reference in Excel
- Address Function in Excel
- Choose Function in Excel
- Column Function in Excel
- Columns Function in Excel
- REPLACE Function in Excel
- GetPivotData in Excel
- HLOOKUP in Excel
- Hyperlink Excel Function
- INDIRECT Function in Excel
- LOOKUP Excel Function
- Match Excel Function
- VLOOKUP Excel Function
- INDEX Excel Function
- VLOOKUP vs HLOOKUP
- Maths Functions in Excel
- POWER Function in Excel
- EVEN Function in Excel
- ODD Function in Excel
- ABS Function in Excel
- SUM Function in Excel
- SUMPRODUCT Function in Excel
- SUBTOTAL Excel Function
- ROUND in Excel
- AGGREGATE Excel Function
- PRODUCT Excel Function
- RAND Excel Function
- LOG Excel Function
- EXPONENTIAL Excel Function
- SUMIF in Excel
- TAN Excel Function
- CEILING Excel Function
- LN Excel Function
- SIGN Excel Function
- COS Excel Function
- FLOOR Function in Excel
- SIN Excel Function
- Date and Time Function in Excel
- Statistical Function in Excel
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. MID function can be used as 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 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 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.
You can download this MID Function in Excel template here – MID Function Excel Template
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 –