MID and MIDB functions to cut strings in Excel
In the previous articles, I introduced you to LEFT () and RIGHT () to cut the string to the left and right of the text. In this article, I will introduce to you the MID (), MIDB () functions to cut the string from the position you want to start cutting the string.
MID and MIDB functions to cut strings in Excel Picture 1
The article describes the syntax and usage of MID () and MIDB () functions to cut strings in Excel.
Description
The MID () function returns a string from a text string, with the position to start extracting from the text string and the number of characters returned by the string that is specified. Functions used in languages use a single-byte character set (SBCS) and always count each character as 1.
The MIDB () function returns a string from a text string with the start of extraction and the specified number of bytes returned. The function counts each double-byte character as 2 when the default language is one of the languages that supports DBCS.
Syntax
= MID (text, start_num, num_chars)
= MIDB (text, start_num, num_bytes)
Inside:
- text: is the text string you want to extract the substring.
- start_num: is the starting position to extract characters from the text string, calculated from the left to (the first character in the text string is 1, the second character is 2 .).
- num_chars: the number of characters you want to extract from the text string.
- num_bytes: the number of bytes you want to extract from the text string.
Note
- If start_num is less than 1, the function returns the #VALUE! Error value.
- If start_num is greater than the length of the text string, the function returns the empty string.
- Start_num is smaller than the text length, but start_num + num_chars (num_bytes) is bigger than the text length, the function returns the string from star_num to the end of the text string.
- Num_chars, num_bytes must be a positive integer, if it is a negative number, the function returns an error value.
For example
MID and MIDB functions to cut strings in Excel Picture 2
So that you have learned about MID () and MIDB () string functions, you can combine them with other functions to achieve high efficiency in the process of string processing. Good luck!
You should read it
- How to concatenate strings in Excel
- Text and string processing functions in Excel
- Separate text from strings in Excel, for example, and how to do it
- Instructions for cutting strings, concatenating strings in Excel
- LEFT and LEFTB functions - Functions for cutting strings in Excel
- Summary of trigonometric functions in Excel
- How to use MID functions to get strings in Excel
- Split numbers from strings in Excel
- How to fix the SUM function doesn't add up in Excel
- Complete financial functions in Excel you should know
- SEARCH () and SEARCHB () functions in Excel
- MS Excel - Lesson 5: Excel formulas and functions
May be interested
LOOKUP function searches in Excel
CELL function to look up information of a cell in Excel
LEFT and LEFTB functions - Functions for cutting strings in Excel
The OFFSET function returns a reference in Excel
The RAND function returns a random real number, greater than or equal to 0 and less than and equal to 1
Summary of data functions in Excel