Microsoft Excel defines MID
function as a formula that “Returns the characters from the middle of a text
string, given a starting position and length.”
This means that we have to supply MID function three
things
1. The
source string
2. The
starting position for extracting the substring and
3. The
length of resultant string.
Syntax
The syntax for the MID function in Microsoft Excel is:
MID( text, start_position,
number_of_characters )
Parameters or Arguments
text
The string that you wish to
extract from.
start_position
The position in the string
that you will begin extracting from. The first position in the string is 1.
number_of_characters
The number of characters that
you wish to extract.
Examples of MID Formula:
In the above example I have used two MID functions:
1. In
the first function I have used a formula =MID(A1,1,4) . So this formula starts
extracting the substring from the input string present at ‘A1’. The extraction
begins at position 1 and ends after 4 characters and hence the result a
substring “This”.
2. In
the second function the MID formula is used as: =MID(A3,6,5). In this example
the substring is extracted from the text present in ‘A3’ cell and the
extraction begins from 6th position and ends after 5 characters and that’s why
the resultant substring is “is an”.
Remarks
·
If start_num is greater than the length of text,
MID returns "" (empty text).
·
If start_num is less than the length of text,
but start_num plus num_chars exceeds the length of text, MID returns the
characters up to the end of text.
·
If start_num is less than 1, MID returns the
#VALUE! error value.
·
If num_chars is negative, MID returns the
#VALUE! error value.
Reference :
follow us on http://arivilm.blogspot.in
like us on https://www.facebook.com/Arivilm2501/
No comments:
Post a Comment