Return characters from the middle of a text string, given a start position and length.
This function works the same in Google Sheets as it does in Excel — same syntax and arguments.
MID(text, start_num, num_chars)MID extracts a substring starting at any position. Combined with FIND or SEARCH, it pulls values from between delimiters — for example, the text between two slashes or after a code prefix.
=MID("AB-1234-X", 4, 4)Result: 1234
Returns 4 characters starting at position 4.
Replace the fixed numbers with FIND, e.g. MID(A2, FIND("-",A2)+1, 4), so it adapts to each row.