Summary

[external_link_head]The Excel MID function extracts a given number of characters from the middle of a supplied text string. For example, =MID(“apple”,2,3) returns “ppl”.

Purpose

Extract text from inside a string

Return value

The characters extracted.

Syntax

=MID (text, start_num, num_chars)

Arguments

**text**– The text to extract from.**start_num**– The location of the first character to extract.**num_chars**– The number of characters to extract.

Usage notes

The MID function extracts a given number of characters from the *middle* of a supplied text string. MID takes three arguments, all of which are required. The first argument, *text*, is the text string to start with. The second argument, *start_num*, is the position of the first character to extract. The third argument, *num_chars*, is the number of characters to extract. If *num_chars* is greater than the number of characters available, MID returns all remaining characters.

Mục Lục

### Examples

The formula below returns 3 characters starting at the 5th character:

=MID ("The cat in the hat",5,3) // returns "cat"This formula will extract 3 characters starting at character 16:

=MID ("The cat in the hat",16,3) // returns "hat"If

num_charsis greater than remaining characters, MID will all remaining characters:=MID ("apple",3,100) // returns "ple"MID can extract text from numbers, but the result is text:

[external_link offset=1]=MID (12348,3,4) // returns "348" as text## Related functions

Use the MID function to extract from the

middleof text. Use the LEFT function to extract text from theleftside of a text string and the RIGHT function to extract text starting from therightside of text. The LEN function returns the length of text as a count of characters. Use FIND or SEARCH to locate an unknown start position.## Notes

*num_chars*is optional and defaults to 1.- MID will extract text from numeric values, but the result is text
- Number formatting is not counted or extracted.

Related functions

The Excel LEFT function extracts a given number of characters from the left side of a supplied text string. For example, LEFT(“apple”,3) returns “app”.

The Excel RIGHT function extracts a given number of characters from the *right* side of a supplied text string. For example, RIGHT(“apple”,3) returns “ple”.

The Excel MID function extracts a given number of characters from the middle of a supplied text string. For example, =MID(“apple”,2,3) returns “ppl”.

The Excel LEN function returns the length of a given text string as the number of characters. LEN will also count characters in numbers, but number formatting is not included.

## Download 100+ Important Excel Functions

Get over 100 Excel Functions you should know in one handy PDF.

## Excel video training

Quick, clean, and to the point.

Learn more

[external_footer]