Returns text from the middle of a text string.
MID(text, start, number)
returns number characters from the text text, starting at position start.
MID("output", 3, 2)
returns tp.
Let's imagine you are an analyst for a large company, and you have a list of product IDs in a spreadsheet. The product ID is structured as follows: [Region Code]-[Product Type Code]-[Unique Identifier].
You need to extract the "Product Type Code" for each product to perform an analysis on the types of products being sold. The Product Type Code is always a 4-character code located in the middle of the string.
Product ID | Region Code | Product Type Code | Unique Identifier | ||
|---|---|---|---|---|---|
A | B | C | D | ||
1 | NA-ELEC-7890 | NA | ELEC | 7890 | |
2 | EU-FASH-1234 | EU | FASH | 1234 | |
3 | AS-HOME-5678 | AS | HOME | 5678 | |
4 | NA-TECH-9012 | NA | TECH | 9012 | |
5 | EU-AUTO-3456 | EU | AUTO | 3456 |
The Region Code is always the first two characters of the string. To extract this using MID, you need to specify a starting position of 1 and a length of 2.
Formula: MID(A1, 1, 2)
Result for "NA-ELEC-7890": NA
The Product Type Code is a four-character code that is consistently located in the middle of the string. It starts after the hyphen following the Region Code.
Formula: MID(A1, 4, 4)
Result for "NA-ELEC-7890": ELEC
The Unique Identifier is a four-digit number at the end of the string. To extract this using MID, you need to specify a starting position that accounts for the preceding parts.
Formula: MID(A1, 9, 4)
Result for "NA-ELEC-7890": 7890
This demonstrates how the MID function, by changing its start position and number of characters, can be used to isolate and extract different segments from a structured text string.
PRODUCT & FEATURES
RESOURCES
Terms | Privacy | Spam Policy
© 2026 Zapof