Excel mid functionThe mid function specified the extraction of elements from the middle of the string. The element can be in the form of numbers, characters, or symbols. It also includes spaces between two or more words or numbers. We can specify the number of characters we want to extract from the middle of the given data element. It is given by: MID(text, start position, Number_of_characters) Where, Text refers to the specified cell from which we want to extract the elements. Start_position refers to the position from where we want to start extracting. Number_of_characters refers to the number of characters we want to extract from the given data in excel. For example, Data string = 123ABC456 Here, we want to extract the code in the form of characters present in the middle of each string. So, we will use the MID() function. It is given by: MID(123ABC456, 4, 3) Here, the character is present at the fourth position (A). Excel will start extracting three characters from the fourth position. The extraction will occur at the respective positions 4th, 5th, and 6th. Thus, excel will return the output as: Output: ABC Here, we will also discuss the MIDB() function, another part of the MID() function that counts double-byte character as 2. The MID() function counts the double-type character as 1. It will be discussed later in the topic. Important points
Let's first consider some examples of the excel MID() function. ExamplesExample 1: To extract the code number present in the string.Here, each string in excel consists of a code. We want to extract the number code from the given string. The number code is present in the middle o f the string. It is just an example for better understanding. We can also create our own example. Consider the below steps:
The MID() function on each cell will work as: =MID(ABC123DEF,4,3) It will return '123' as the output =MID(IJK234LMB,4,3) It will return '234' as the output =MID(HTY654IYT,4,3) It will return '654' as the output =MID(TYR765HYU,4,3) It will return '765' as the output =MID(UTE678FVG,4,3) It will return '678' as the output =MID(FKH194GTY,4,3) It will return '194' as the output Example 2: To extract a word from the given sentences.Consider the below steps:
Note: Like the MID() function, LEFT() and RIGHT() functions are also used to extract the number of characters from the given string. The LEFT() function extracts the characters from the left side of the specified string and RIGHT() function extracts the characters starting from the right side of the specified string.Example 3: To extract from the list of five students.Here, we will first extract the first name from the list of students. The list is given below: The given list has specified first names of upto five characters. The first name has four characters, and the fifth one is extra space. Excel will consider the extra space as the fifth character. Consider the below steps:
MIDB() function in excelLet's have a quick look at the MIDB() function in excel to eliminate the confusion between the MID() function and MIDB() function. MIDB() function considers the double-byte character as 2 when we enable editing a language that supports DBCS (Double-Byte Character Set) and set it as a default language. Otherwise, it considers 1. In the case of MID() function, excel considers both the double byte character and single byte character as 1. The double-byte languages are Chinese, Korean, and Japanese. Such languages are difficult to represent in a single quote. It is given by: MIDB(text, start position, Number_of_characters) Where, Text refers to the specified cell from which we want to extract the elements. Start_position refers to the position from where we want to start extracting. Number_of_bytes refers to the number of characters we want to extract from the given data in excel. The output and the conditions of the MIDB() are similar to that of MID() function. Let's consider some examples. Example 1: Text: Ahaan Malhotra Syntax: =MIDB(Ahaan Malhotra,1,5) Value returned: Ahaan Example 2: Text: IJK234LMB Syntax: =MIDB(IJK234LMB,4,3) Value returned: 234 Next TopicExcel right function |