Home  >  Article  >  Topics  >  What is the function of mid function in excel?

What is the function of mid function in excel?

青灯夜游
青灯夜游Original
2020-10-09 12:58:3025803browse

The function of the mid function in excel is: starting from the specified position of a text string, intercepting the specified number of characters; the syntax format is "MID (text, start_num, num_chars)", text represents the string, and start_num represents Starting position; num_chars represents the interception number.

What is the function of mid function in excel?

excel mid function

Main function: From the specified position of a text string Start by intercepting the specified number of characters.

When the Mid function intercepts a string, whether it is Chinese characters, letters or numbers, it is counted as one character

Usage format:

MID(text,start_num,num_chars)

Parameter description:

  • text represents a text string

  • start_num is the starting position of the character to be extracted, it must be greater than or equal to 1, otherwise an error will be returned; If start_num is greater than the text length, null will be returned; if start_num is less than the text length plus Num_Chars is greater than the text length, only characters up to the end of the text will be returned.

  • Num_Chars is the number of characters to be extracted. It must be greater than 0, otherwise a #VALUE! error will be returned.

How to use Excel Mid function

1. Intercept Chinese characters

Select cell H4, enter the formula =MID(B4,3,2), press Enter, return to "Short Sleeves", the operation process steps are as shown in the figure below:

What is the function of mid function in excel?

Note: The content of B4 is "pink short-sleeved shirt", start_num is 3, Num_Chars is 2, that is, extraction starts from the third character, and the length of the extracted string is 2, so "short-sleeved shirt" is returned; description The MID function counts each Chinese character as one character.

2. Reverse value (ie, value from right to left)

If you want to get the value from the 4th digit from the bottom and only take 4 characters. Copy the formula =MID(A1,LEN(A1) - 4 1,4) to cell B1, as shown below:

What is the function of mid function in excel?

Press Enter to return to "Basics" Tutorial", as shown in the figure below:

What is the function of mid function in excel?

Instructions: The formula first uses the Len function to return the length of the string A1, and then uses it to subtract the 4th digit and add 1, so You can locate the beginning of the string to be intercepted. The interception length is 4, so the four words "Basic Tutorial" are returned. If you want to intercept the third to last digit, just change 4 to 3, and the formula becomes =MID(A1,LEN(A1) - 3 1,3), as shown in the figure below:

What is the function of mid function in excel?

The result is returned to "Basic Tutorial", as shown below:

What is the function of mid function in excel?

The above is the detailed content of What is the function of mid function in excel?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn