MID Function in Excel: Extract Text From the Middle

📎 This article includes 1 downloadable practice file ↓

⏱ 1 min readUpdated 28 September 2026

TextLevel: BeginnerAvailable in: Excel 2007+

In this article
  1. Syntax
  2. Examples
  3. Example 1
  4. Example 2
  5. Related functions

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

Syntax

=MID(text, start_num, num_chars)
Argument What it means
text The text.
start_num Position of the first character (1 = first).
num_chars How many characters to take.

Examples

Example 1

=MID(A2, 3, 10)

PAN from a 15-character GSTIN.

Example 2

=MID(A2, 4, 2)

Month from a code like INV0525-001.

LEFT · RIGHT · FIND · SEARCH

📚 Part of the free Excel course: Beginner → Expert · Try it in the Formula Lab or ask the AI Helper.

📎 Practice files for this article

  • 📗
    Text-cleaning scenarios workbookExtract and clean text (GSTIN, PAN, emails, names) with PASS/FAIL checks, plus the 3 mistakes that break text formulas.
    ⬇ XLSX · 8 KB

Free to use for learning. Files with macros (.bas) are plain text — import them with Alt+F11 → File → Import File, and always test on a copy.

✨ Ask AI about this article

Stuck on a step? Ask a question and the AI answers using this article.

Free · AI can be wrong