LEFT, RIGHT, and MID Generator
Pull a set number of characters out of a cell from the start, the end, or any position.
LEFT RIGHT MID
Pull a set number of characters out of a cell from the start, the end, or any position.
The cell to extract characters from.
Which character to start at, counting from 1 for the first character. Required.
How many characters to return from the start position onward. Required for MID, optional for LEFT and RIGHT.
=MID(A2, 5, 3)Worked Example
A2 contains the product code SKU-123-RED and you want the three-digit number in the middle.
=MID(A2, 5, 3)Returns: Returns 123 as text, starting at the fifth character. Wrap it in VALUE if you need a real number.
Checks Before You Paste
- •MID counts from 1, not 0. A start_num below 1, or a negative num_chars, returns #VALUE!, while a num_chars that runs past the end of the text simply returns whatever is left with no error.
- •Swap to LEFT(text, [num_chars]) to take characters from the start and RIGHT(text, [num_chars]) to take them from the end. Both take num_chars as an optional second argument that defaults to 1; MID needs all three arguments.
- •When the position varies, feed it from FIND or SEARCH, for example =MID(A2, FIND("-", A2)+1, 3). FIND is case sensitive and SEARCH is not, and SEARCH also accepts the wildcards * and ?.