• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

extracting data from string

siddharthsopori

New Member
Hi Guys ,


I am in a crunch situation.


I want to extract data from a set of strings.


Eg.

Product A123 does not exist in plant 111

Product B123 does not exist in plant 222

Product C123 does not exist in plant 333


so i should be able to extract

Products. A123 ,B123 & C123 in one sheet

and plants 111 ,222 n 333 in another sheet.


Regards

Siddharth
 
Here's a generic format you could use to extract strings.

=TRIM(LEFT(SUBSTITUTE(MID(A1,SEARCH($B$1,A1)+LEN($B$1)+1,999)," ",REPT(" ",999)),999))


Where A1 is the cell containing sentence, and B1 contains the word preceding the word you want to extract. In your case, that would be either "product" or "plant".
 
Besides what Luke said you could also use:

[pre]
Code:
=TRIM(MID(A1,FIND("Product",A1,1)+8,4)) &
=TRIM(MID(A1,FIND("plant",A1,1)+5,4))
[/pre]

Your strings are in A1:A3


Regards,
 
if you want to go the vba route, the string functions (InStr, StrComp, StrConv) are perfect for what you want. Just depends on if you want to go that way or not.
 
Back
Top