Excel MID Function: Syntax, Examples & Tips

The MID function extracts characters from a text string by specifying the starting position and the number of characters to return.
Excel
=MID(text, start_num, num_chars)

One free generation or explanation per browser, shared across Excel and Google Sheets. Account usage limits apply afterward.

Need more than a single MID formula? Try our free AI for Excel — it reads your entire spreadsheet, answers questions in plain English, and builds charts and analysis in the same chat.

On this page
  1. Parameters
  2. What is a MID Formula in Excel?
  3. A Practical Example
  4. MID Formula
  5. Result of the Formula
  6. Why Use MID?
  7. Key Takeaways:
  8. Example use case

Parameters

text:
The text string from which you want to extract a substring. This can be a text string, a cell reference containing text, or a formula that returns text.

start_num:
The position of the first character you want to extract from the text. The first character in the text string is at position 1.

num_chars:
The number of characters you want to extract from the text, starting from the position specified by start_num.

What is a MID Formula in Excel?

The MID function in Excel is a text manipulation tool that allows you to extract a specific number of characters from a text string, starting at a designated position. This function is particularly useful when you need to isolate a portion of text from a larger string, making it easier to analyze or manipulate data.

In simpler terms, the MID function helps you extract substrings from text, which can be essential for data cleaning and formatting tasks.

A Practical Example

Imagine you have a list of product codes in an Excel spreadsheet, and you want to extract the model number from each code.

Product Codes Table:

Product Code
ABC-1234-XYZ
DEF-5678-QWE
GHI-9101-RTY
JKL-1121-UIO
MNO-3141-PAS

You want to extract the model number, which is the four characters starting from the fifth position in each product code.

MID Formula

To extract the model number from the product codes, you would use the MID formula as follows:

Excel
=MID(A2, 5, 4)

Breakdown of the Formula:

  • A2: This is the cell containing the text string (product code) from which you want to extract characters.
  • 5: This is the starting position in the text string from which to begin extracting characters.
  • 4: This is the number of characters to extract from the starting position.

Result of the Formula

When you apply the formula to each product code, it extracts the model numbers as follows:

Model Number
1234
5678
9101
1121
3141

Here, the extracted model numbers correspond to the four characters starting from the fifth position in each product code.

Why Use MID?

The MID function is particularly useful when you need to extract specific parts of text strings for analysis or reporting. It allows you to manipulate text data efficiently without the need for complex formulas or manual editing.

Key Takeaways:

  • MID: Extracts a specified number of characters from a text string, starting at a defined position.
  • Efficient Text Manipulation: Helps you isolate and analyze specific portions of text data.
  • Common Use Cases: Ideal for parsing codes, cleaning data, and any scenario where you need to extract substrings from larger text strings.

Understanding how to use the MID function can significantly enhance your data manipulation capabilities in Excel, enabling you to work more effectively with text data.

Happy extracting!

Example use case

You have a list of product codes in Column A, where each code consists of a combination of letters and numbers. You want to extract a specific part of each product code, such as the numeric portion, which starts from the 5th character and is 3 characters long. By using the MID function, you can easily extract this numeric portion for further analysis or reporting. This simplifies the process of data manipulation and allows for better organization of product information without the need for complex string functions.

Beyond the MID function: Better Analyst is a full Excel AI that goes well past individual formulas. Upload any spreadsheet and ask questions in plain English — you'll get formulas, data analysis, and charts back in seconds. It's a free AI Excel assistant that works with any .xlsx, .xls, or .csv file — no plugins, no Microsoft 365 required.

Don't have a spreadsheet yet? Use our free AI spreadsheet generator to turn a text prompt into a downloadable Excel file — a full AI Excel sheet maker that builds headers, columns, and formulas from your description.

Need more help with Excel formulas?

Create a free account for formula help, explanations, and spreadsheet analysis. Usage limits depend on your plan.

Explore all Excel formulas

Browse our complete library of Excel formula guides

Compare your options

Decide with evidence, not a sales pitch.

Open a neutral research prompt in the AI tool you already use. Compare capabilities, limitations, and fit before you choose.

  1. 01ChatGPTOpen a balanced comparison prompt in ChatGPT.
  2. 02ClaudeOpen the same research prompt in Claude.
  3. 03PerplexityResearch the comparison with linked web sources.

AI answers can be incomplete. Check source links, current pricing, and product documentation before deciding.