MID Function Example

Automate Excel

MID Function Example

You can use the MID function to extract a string from a string. In this example we want to remove the middle three numbers from a social security number, or extract the shorter string 456 from 123-456-7890. We do this with the MID function.

The syntax for the mid function is:

=MID(text, start_num, num_chars)

text is the text to extract from or look in. In this case we would indicate the cell containing 123-456-7890

start_num is the number of characters to count over in the original string to begin extracting. Here we want to start our new string at the 5th character.

num_chars is the number of characters to extract, starting with our start_num. We want to take 3 characters from the larger string starting with our start_num.

Finally, to extract the shorter string 456 from 123-456-7890 we use the function: (this assumes our larger string is in cell A1)

=MID(A1,5,3)

MID

Leave a Comment

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.