Solved

# trying to extract a text string from a given area in a cell

Posted on 2011-10-27
237 Views
I am trying to extract a text string in a cell within a givien set of characters. I have enclosed an example. text-extract-spread.xlsx
0
Question by:wagamama123

LVL 50

Expert Comment

try this

=LEFT(MID(A5,FIND("(",A5,FIND("(",A5)+1)+1,99),FIND("-",MID(A5,FIND("(",A5,FIND("(",A5)+1)+1,99),2)-1)+0
0

LVL 12

Accepted Solution

Try this.  It's kind of a monster but I think it works.

=MID(A1,FIND("**",SUBSTITUTE(A1,"(","**",2))+1,FIND("**",SUBSTITUTE(A1,"-","**",LEN(A1)-LEN(SUBSTITUTE(A1,"-",""))))-FIND("**",SUBSTITUTE(A1,"(","**",2))-1)

Kyle
0

LVL 6

Expert Comment

Here is one way of approaching this
``````=MID(A1,FIND("(",A1,FIND("(",A1,1)+1)+1,FIND("-",A1,FIND("(",A1,FIND("(",A1,1)+1)+2)-FIND("(",A1,FIND("(",A1,1)+1)-1)
``````
0

LVL 50

Expert Comment

If the last number is always 3 digits as per your example, 110, 114 etc. then this should work

=LOOKUP(10^5,RIGHT(LEFT(A1,LEN(A1)-6),{1,2,3,4,5})+0)

regards, barry
0

Author Closing Comment

thank you!
0

LVL 12

Expert Comment

Was there something in your data set that caused mine to work where teylyn's, reitzen's, and Barry's didn't?
0

## Featured Post

### Suggested Solutions

This tutorial explains how to create a series of drop-down lists that are dependent upon prior selections to guide (“force”) the user to make the correct selection and reduce data errors within Microsoft Excel. Excel 2010 was used for this tutorial;…
This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
The viewer will learn how to simulate a series of coin tosses with the rand() function and learn how to make these “tosses” depend on a predetermined probability. Flipping Coins in Excel: Enter =RAND() into cell A2: Recalculate the random variable…
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…