ExcelReady
CourseMock testsFunction guidesBlog
Start freeStart learning for free
ExcelReady

Be Excel-ready before day one. Hands-on practice in your browser, with instant feedback.

Learn

  • Course
  • Mock tests
  • Function guides
  • Blog

Test prep

  • Excel test practice
  • Free screening quiz
  • Certificate

Company

  • Editorial policy
  • Contact
  • Terms
  • Privacy

© 2026 ExcelReady. All rights reserved.

Function guides / MID

The MID function in Excel

MID returns a set number of characters starting at any position you choose. Use it on its own for codes with a fixed layout, like the year inside an order ID. Pair it with FIND to pull out pieces whose position changes, such as an email domain or the text between two brackets.

Syntax

=MID(text, start_num, num_chars)
textThe text or cell to take characters from.
start_numThe position of the first character you want. The first character in the text is 1.
num_charsHow many characters to return. If this runs past the end of the text, MID just returns what's left.

Try it yourself

This is a live spreadsheet. Type the formula and press Enter.

Every staff ID follows the format LDN-4821-HR: office, 4-digit number, department. In C2, use MID to extract the staff number from the ID in A2.

fx
ABCDEFG
1
Staff ID
Name
Staff number
2
LDN-4821-HR
Grace Owusu
3
NYC-0937-FIN
Marco Bianchi
4
SGP-5510-OPS
Wei Ling Tan
5
BER-2264-IT
Jonas Weber
6
7
8

Tip: Count the characters to see where the number starts, then tell MID how many digits to take.

Examples

=MID(A2,5,4)→ "2025"

Starts at the 5th character and takes 4, which is the year in this order ID.

=MID(B2,FIND("@",B2)+1,100)→ "northwind.com"

FIND locates the @, and MID starts one character after it. Asking for 100 characters simply takes the rest of the email: the domain.

=MID(C3,FIND("(",C3)+1,FIND(")",C3)-FIND("(",C3)-1)→ "Sales"

Extracts the text between the brackets. The length is the gap between the two bracket positions, minus one.

Example data

1Order IDEmailEmployee
2ORD-2025-0417maria.lopez@northwind.comJordan Lee (Finance)
3ORD-2024-1182sam.ito@bluepeak.ioPriya Nair (Sales)

Common mistakes

  • Off by one around a separator

    FIND returns the position of the separator itself. Add 1 to start just after it, and subtract 1 from a length so you don't include the closing character.

  • Hardcoding a length for variable text

    MID(B2,13,9) works for one email but cuts others short. Calculate the length with FIND, or use a large number like 100 when you want everything to the end.

  • The result is text, not a number

    MID(A2,5,4) returns the text "2025", which won't add up or match a number. Wrap it in VALUE when you need a real number.

  • A start position of 0

    Positions start at 1. A start_num below 1 returns #VALUE!.

FAQ

How do I extract text between two characters?+

Find both characters and take the gap: =MID(A2,FIND("(",A2)+1,FIND(")",A2)-FIND("(",A2)-1).

What happens if num_chars is longer than the text?+

MID returns everything from start_num to the end, without an error. That's why a large number like 100 is a common shortcut.

Is there an easier way than MID and FIND?+

In Microsoft 365, TEXTBEFORE and TEXTAFTER do it more simply: =TEXTBEFORE(TEXTAFTER(A2,"("),")"). Many workplaces still use older versions, so MID is worth knowing.

Lesson

Master MID step by step: LEFT, RIGHT, MID and LEN

Split product codes and IDs into their parts by taking characters from the start, end or middle of the text.

Related functions

FINDLEFTRIGHTLEN