MID FORMULA

 

Extract Text Between Two Words in Excel (Using MID + FIND)



Sometimes in Excel you need to extract a specific part of a sentence, especially when it appears between two words. For example, you may want to extract the text between “to” and “as per”.

This formula helps you do that automatically.

The Formula

=MID(E6,FIND("to",E6)+3,FIND("as per",E6)-FIND("to",E6)-3)

Example Data

Cell E6 contains:

Transfer payment to John Smith as per agreement

Result

The formula will return:

John Smith

How the Formula Works

1️⃣ FIND("to",E6)

This finds the starting position of the word "to" inside the text.

Example:

Transfer payment to John Smith as per agreement

2️⃣ +3

We add 3 characters to move past "to " (including the space).

So extraction starts right after "to ".


3️⃣ FIND("as per",E6)

This finds where the phrase "as per" begins.

Transfer payment to John Smith as per agreement

4️⃣ FIND("as per",E6) - FIND("to",E6) - 3

This calculates the length of the text between the two phrases.

So Excel knows how many characters to extract.


Final Logic

The formula tells Excel:

Start after "to " and extract text until "as per" appears.


Best Use Cases

  • Extract names from descriptions

  • Pull locations from sentences

  • Clean transaction descriptions

  • Automate text parsing


💡 Pro Tip:
If your text structure changes often, consider using newer functions like TEXTBEFORE / TEXTAFTER in modern Excel.

Comments