How to extract text between multiple dashes?

Gramlights

New Member
Joined
Oct 6, 2021
Messages
1
Office Version
  1. 365
Platform
  1. Windows
Looking for a formula to extract text from between the 2nd and 3rd dash ("-").

Example: Create a formula to extract the word "pear"
apple-orange-pear-guava

But ONLY using the functions of MID, FIND, LEFT, RIGHT.

Note:
I'm able to come up with a formula to extract the word between the 1st and 2nd dash ("orange"), however I'm not quite sure how to manipulate the formula to achieve other nth extractions.
=MID(A1,FIND("-",A1,1)+1,FIND("-",A1,FIND("-",A1)+1)-FIND("-",A1)-1)

Thank you so much all!
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
A UDF makes this so much easier though
 
Upvote 0
This sounds a lot like an assignment?

You already have the basic logic since you're using the third argument to FIND (the position to start the find from) but your formulas will be ugly.
 
Upvote 0
Why make it yourself hard when you have better functions for this problem. Change the 3 in the formula below to get the nth extraction.

Excel Formula:
=SUBSTITUTE(MID(SUBSTITUTE("-"&A1,"-",REPT("@",50)),50*3,50),"@","")
 
Upvote 0

Forum statistics

Threads
1,214,894
Messages
6,122,124
Members
449,066
Latest member
Andyg666

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top