Cellwise

Text function

Excel MID function

MID returns a chunk of text from the middle of a string. You tell it where to start and how many characters to take. Use it to pull a year out of an order ID or a middle section from a code.

fx=MID(text, start_num, num_chars)

Arguments

text
The text or cell to take characters from.
start_num
The position of the first character you want. The first character is 1.
num_chars
How many characters to return.

MID examples

Every result below was calculated live from this sample sheet.

ABC
1Order IDEmailCustomer
2ORD-2025-00871kim.lee@harbor.ioKim Lee
3ORD-2024-01934p.nash@delta.comPat Nash
4ORD-2025-00042mo@sunrise.coMo Ali
  1. fx=MID(A2,5,4)

    Result: 2025

    Starts at character 5 and takes 4: the year "2025".

  2. fx=MID(A3,10,5)

    Result: 01934

    Jumps past "ORD-2024-" to return the sequence number "01934".

  3. fx=MID(B2,FIND("@",B2)+1,100)

    Result: harbor.io

    Everything after the @ sign: the email domain. A large count just takes the rest.

  4. fx=VALUE(MID(A4,10,5))

    Result: 42

    MID returns text, so VALUE turns "00042" into the number 42.

How to use MID

  1. Find the position where your piece starts. Count from 1, or use FIND.
  2. Type =MID( and select the text cell.
  3. Add the start position, then the number of characters.
  4. Close the bracket.

Common MID mistakes

Counting from 0

Excel counts the first character as 1. MID(A2,0,3) returns #VALUE!.

Forgetting the third argument

Unlike LEFT and RIGHT, MID needs num_chars. Use a big number like 100 to take the rest of the text.

Fixed positions on uneven data

If the pieces move around, find the start with FIND or SEARCH instead of hard-coding it.

MID FAQ

How do I extract text between two characters in Excel?

Find both positions and subtract: =MID(A2,FIND("(",A2)+1,FIND(")",A2)-FIND("(",A2)-1) returns what is inside the brackets.

How do I get the email domain in Excel?

Use =MID(A2,FIND("@",A2)+1,100). It starts right after the @ and takes everything to the end.

What happens if num_chars goes past the end of the text?

Nothing bad. MID just returns the characters up to the end, so a big number is a safe way to say "the rest".

Guides that use MID

Related functions

Updated 2026-10-31