MID and MIDB functions to cut strings in Excel

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.

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.

Picture 1 of MID and MIDB functions to cut strings in Excel

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

Picture 2 of MID and MIDB functions to cut strings in Excel

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've just finished reading the article "MID and MIDB functions to cut strings in Excel" edited by the TipsMake team. You can save mid-and-midb-functions-to-cut-strings-in-excel.pdf to your computer here to read later or print it out. We hope this article has provided you with many useful tech tips and tricks. You can search for similar articles on tips and guides. Thank you for reading and for following us regularly.

« PREV LOOKUP function searches in Excel
NEXT » The VALUE function converts a numeric string to a number format in Excel