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
-
Extracting a segment from a string:
- Example:
=MID("Hello World!", 7, 5) - Result:
"World"
- Example:
-
Using
MIDwith a cell reference:- Example: If
A1contains"Invoice-2024-0567", then=MID(A1, 9, 4)will return"2024".
- Example: If
Use Cases and Scenarios
- Data Cleanup: Extract a specific part of a messy or structured data string, like a date embedded in an ID.
- Text Manipulation: Retrieve certain words or phrases from a longer piece of text.
- 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.