Google Sheets MID Function: Syntax, Examples & Tips

The MID function extracts a specific number of characters from a text string, starting at a designated position.
Google Sheets
MID(string, starting_at, extract_length)

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

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

Parameters

string:
The text string from which you want to extract a substring.

starting_at:
The position in the string where the extraction begins. The first character in the string is position 1.

extract_length:
The number of characters to extract from the string, starting from the starting_at position.

What is a MID Function?

The MID function in Google Sheets is a text function used to extract a specific number of characters from a string, starting at a specified position. This function is particularly useful when you need to isolate a portion of text from a larger string, making it easier to manipulate and analyze data.

In simpler terms, MID allows you to pull out a segment of text from a longer string based on your specified criteria.

A Practical Example

Imagine you have a list of product codes that include both letters and numbers, and you want to extract a specific part of these codes for further analysis.

Product Codes Table:

ProductCode
ABC123XYZ
DEF456UVW
GHI789RST

You want to extract the numeric part of each product code, which starts from the 4th character and is 3 characters long.

MID Formula

To achieve this, you would use the MID function as follows:

Google Sheets
=MID(A2, 4, 3)

In this formula:

  • A2 is the cell containing the ProductCode.
  • 4 is the starting position from which to begin extracting characters.
  • 3 is the number of characters to extract.

Result of the Formula

When you apply the MID formula to the Product Codes Table, the output would look like this:

ProductCodeNumericPart
ABC123XYZ123
DEF456UVW456
GHI789RST789

In this case, the MID function successfully extracts the numeric part of each product code.

Why Use MID?

MID is beneficial because it allows for precise text manipulation within your data. It simplifies the process of extracting specific segments of text, which can be crucial for data analysis, reporting, and data cleaning tasks.

Key Takeaways:

  • MID: A text function that extracts a specified number of characters from a string, starting at a defined position.
  • Text Manipulation: Useful for isolating specific segments of text for analysis or reporting.
  • Common Use Cases: Ideal for data cleaning, parsing product codes, and any scenario where specific text extraction is necessary.

The MID function is an essential tool for anyone working with text data in Google Sheets, providing a straightforward way to enhance data analysis and reporting capabilities.

Happy spreadsheeting!

Example use case

You have a list of product codes in Column A and need to extract the middle three characters for categorization. Using the MID formula, you can easily pull these characters into Column B, streamlining your inventory management and analysis process.

Need more help with Google Sheets formulas?

Sign up for Better Analyst and get unlimited AI-powered formula generation, explanations, and advanced data analysis.

Explore all Google Sheets formulas

Browse our complete library of Google Sheets 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.