Conditional Data Parsing...

GGK

New Member
Joined
Oct 4, 2011
Messages
40
I need to set up a formula to grab partial data from a cell at a fixed startpoint and end point.

EXAMPLE:

<IGNORE="DONOTUSE_DONOTUSE_DONOTUSE;DK=[DONOTUSE];>
<BYPASS>language='ignoreall'Because="ThisisBADdataThisisBADdata;stuff=10x20;DR=[BadStuff];PEP=[Cherry]">
<PASS="PASSPASSPASS;ONE=2;TWO=3;OK=20x10;BS=[HUH};UCONN=[NOW]?">
NEED="NEEDTHIS_NEEDTHISNOW_THISISIT;butignorealltherestofthis;worthless=[dontneed]"
<PLEASE>
<HELPME>

If i paste the above text into a cell... how can I get the BOLD DATA ONLY, into another cell. (so its all data between NEED=" and the ; is put into the new cell?

Thanks!

Thanks,
GGK
 
Last edited:

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
Hi,

Is it always a fixed number of characters that you are trying to parse??

Ian

Hey Ian,

Nope... the data that i need to extract will always be a variable amount...However, the starting and endpoints will have fixed structures (kind of)

In the above example... i will always need to grab ALL data between NEED=" COPY COPY COPY ;

(so all data starting AFTER the " and then stopping right before the ; )

Does that help/make sense?
 
Upvote 0
This might not be an elegant solution, but could give you ideas!

Assuming that your data is in cell A3

try:-
=MID(A3,SEARCH("need=",A3)+6,SEARCH(";",A3,SEARCH("need=",A3))-SEARCH("need=",A3)-6)

Kelbo
 
Upvote 0
This might not be an elegant solution, but could give you ideas!

Assuming that your data is in cell A3

try:-
=MID(A3,SEARCH("need=",A3)+6,SEARCH(";",A3,SEARCH("need=",A3))-SEARCH("need=",A3)-6)

Kelbo

That worked... Almost.. until i came up with a situation where there was a constant that had a space in between.

Example:

I NEED="this is the data that; needs to be cut;PLEASE=Im almost there!>>

Here... i need at the data from==>> I NEED=" ALL INCLUSIVE ;PLEASE


THANKS!
 
Upvote 0
Give this formula a try...

=MID(LEFT(A1,FIND(";",A1)-1),SEARCH("NEED=""",A1)+6,LEN(A1))
 
Upvote 0
Give this formula a try...

=MID(LEFT(A1,FIND(";",A1)-1),SEARCH("NEED=""",A1)+6,LEN(A1))

Thanks... i'm curious.. if is it possible to put an "OR" function part of the formula... for example... can it extract all data from NEED= all the way to a ";" OR ":" .... whichever comes first..

Thanks,
GGK
 
Upvote 0
This might not be an elegant solution, but could give you ideas!

Assuming that your data is in cell A3

try:-
=MID(A3,SEARCH("need=",A3)+6,SEARCH(";",A3,SEARCH("need=",A3))-SEARCH("need=",A3)-6)

Kelbo

I should probably address this question to Kelbo (to give him credit for the use of his solution)

But...

i'm curious.. if is it possible to put an "OR" function as part of the formula... for example... can it extract all data from NEED= all the way to a ";" OR ":" .... whichever comes first..

Thanks,
GGK
 
Upvote 0
It's not pretty, but I believe this would work....

=MID(A3,SEARCH("need=",A3)+6,MIN(SEARCH(";",MID(A3,SEARCH("need=",A3)+6,255)),SEARCH(":",MID(A3,SEARCH("need=",A3)+6,255)))-1)

It uses MIN instead of OR to evaluate to the first instance of : or ;
 
Upvote 0

Forum statistics

Threads
1,224,600
Messages
6,179,833
Members
452,947
Latest member
Gerry_F

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