FP

FormulaPilot

Spreadsheet formula tools

Open generator
Excel how-to guide

How to mid extract substring in Excel

Extract a department code embedded in the middle of a product ID, or pull the month from a date-formatted text string.

intermediateText ManipulationMID reference

Step-by-step instructions

How to mid extract substring3 steps

1

Identify the position of the first character you want — counting from the left, starting at 1.

2

Enter that position as the second argument.

3

Enter the number of characters you want to extract as the third argument.

Example data

Worked example

Product IDDept Code
XYZ-HR-001HR
XYZ-FN-042FN
XYZ-IT-108IT

Common mistakes

Errors to watch out for

Returns wrong characters

MID starts counting at position 1, not 0. If your result is off by one character, subtract 1 from the start position.

Returns empty string

If the start position is greater than the total length of the string, MID returns an empty string rather than an error.

FAQ

Frequently asked questions

How do I use MID when the start position varies?

Combine MID with FIND to locate a delimiter dynamically — for example, =MID(A2, FIND("-",A2)+1, 3) extracts 3 characters starting right after the first hyphen.

Need a custom variation?

Describe your exact spreadsheet problem — get the formula in seconds.

Open AI Formula Generator — Free

Related how-to guides

Continue learning.