Microsoft Office Tutorials and References

In Depth Information

**Chapter 16: Writing Home about Text Functions**

Use LEFT and RIGHT to extract characters from the start or end of a text

string. Use MID to extract characters from the middle.

Staying in the MIDdle

MID is a powerful text extraction function. It lets you pull out a portion of a

larger string — from anywhere within the larger string. The LEFT and RIGHT

functions allow you to extract from the start or end of a string but not the

middle. MID gives you essentially complete flexibility.

MID takes three arguments: the larger string (or a reference to one); the

character position to start at; and how many characters to extract. Here’s how to

use MID:

1.Positionthecursorinthecellwhereyouwanttheextractedstring

displayed.

2. Enter
=MID(
to start the function.

3.Clickthecellthathasthefulltextentry,orenteritsaddress.

4. Enter a comma (
,).

5.Enteranumbertotellthefunctionwhichcharactertostarttheextraction from.

This number can be anything from 1 to the full count of characters of

the string. Typically the starting character position used with MID is

greater than 1. Why? If you need to start at the first position, you may as

well use the simpler LEFT function. If you enter a number for the

starting character position that is greater than the length of the string, then

nothing is returned.

6. Enter a comma (
,).

7.Enteranumbertotellthefunctionhowmanycharacterstoextract.

If you enter a number that is greater than the remaining length of the

string, then the full remainder of the string is returned. For example, if

you tell MID to extract characters 2 through 8 of a six-character string,

then MID returns characters 2 through 6.

8. Type a
), and press Enter.

Here are some examples of how MID works:

Example

Result

=MID(“APPLE”,4,2)

LE

=MID(“APPLE”,4,1)

L

=MID(“APPLE”,2,3)

PPL

=MID(“APPLE”,5,1)

E