ShareYourGroupShareYourGroupExcel Formulas

Text functions

MID function in Excel

MID returns characters from the middle of a text, starting at a position you give.

MID is the third member of the cutting family. LEFT takes from the start and RIGHT from the end. MID takes from anywhere: "start at character 4 and give me 2".

Syntax

=MID(text, start_num, num_chars)
ArgumentWhat it is
textThe text, or a cell that holds it.
start_numThe position of the first character to take. The first character of the text is 1.
num_charsHow many characters to take.

Examples

Each result below is what Excel itself showed for the formula on the sample sheet.

Sample sheet: Text as people really type it: stray spaces, mixed capitals, codes with dashes.
ABCD
1Full nameEmailCodeAmount as text
2  asha   verma asha.verma@example.comPB-10-12341,250
3RAVI KUMARravi@example.orgDL-08-0042300
4meena gillmeena.gill@example.comMH-12-9876 45.50 
5Kabir Khankabir@example.netRJ-14-000712 kg

How it works

MID needs three things: the text, where to start, and how many characters to take. Counting starts at 1 for the first character. Spaces and punctuation are counted.

All three arguments are required. Unlike LEFT and RIGHT, MID has no default length.

To the end of the text

If you want everything from a starting point onwards and do not know how long the text is, give a number that is certainly large enough, such as 100 or 1000. MID stops at the end of the text and does not pad the result. The fourth example uses this to take the surname from a name.

Finding the start

With fixed-layout codes, the positions are typed in. When the layout varies, FIND supplies the position of a marker:

The third example cuts the piece between a dot and an @ this way. Such formulas are easier to write in steps. Put the two FIND results in helper cells first, check them, and then build the MID. Join them into one formula afterwards if you wish.

The second word, the third field

For text with several separators, such as PB-10-1234, the second FIND must start searching after the first separator. FIND's third argument sets the starting point:

Then MID takes what lies between. This gets long quickly. In Microsoft 365, TEXTSPLIT does the whole job in one function. In other versions, Text to Columns on the Data tab, or Flash Fill, is often quicker for a one-time clean-up.

One character at a time

=MID(A1, n, 1) returns the nth character. With SEQUENCE in Excel 2021 and later, =MID(A1, SEQUENCE(LEN(A1)), 1) spills every character into its own cell, which is the basis of formulas that count digits or check a code character by character.

The result is text

As with LEFT and RIGHT, digits cut out by MID are text. Convert with VALUE or by adding zero when you need a number.

Common mistakes

In Google Sheets

MID is the same in Google Sheets.

Related functions

Every result on this page was calculated in Microsoft Excel (version 16.0, build 20326) on 12 November 2026, not typed by hand.

This is an independent help site. It is not connected with or approved by Microsoft. Excel and Microsoft 365 are trademarks of Microsoft Corporation, named here only to say which program a formula is for. The people and figures in the sample sheets are made up.