Back to Functions

MID

Returns a segment of a string.

TextMID(string, starting_at, extract_length)

The MID function in Google Sheets extracts a specific segment of a string, starting at a given position and continuing for a set number of characters. Whether you need to pull out a word, a code, or a substring buried inside a larger piece of text, the MID function makes it simple. Dive into our comprehensive guide to master its application.

Parameters

  • string: The text from which you want to extract the segment.
  • starting_at: The position of the first character you want to extract.
  • extract_length: The number of characters you want to extract.

Step-by-Step Tutorial

  1. Extracting a segment from a string:

    • Example: =MID("Hello World!", 7, 5)
    • Result: "World"
  2. Using MID with a cell reference:

    • Example: If A1 contains "Invoice-2024-0567", then =MID(A1, 9, 4) will return "2024".

Use Cases and Scenarios

  1. Data Cleanup: Extract a specific part of a messy or structured data string, like a date embedded in an ID.
  2. Text Manipulation: Retrieve certain words or phrases from a longer piece of text.
  3. Data Analysis: Pull key information out of a string for further processing or lookups.

Related Functions

  • LEFT: Returns a substring from the beginning of a string.
  • RIGHT: Returns a substring from the end of a string.
  • MIDB: Returns a section of a string, counted in bytes instead of characters.

Related Articles

Newsletter

More MID examples coming soon.

We are building short, practical updates for Sheets power users.