PDA

View Full Version : Pull text from the left of a character to the right of the next character foun



briguy22
01-06-2016, 08:43 PM
Greetings,

I have some text in a cell that is always laid out in the same format, but the length may be different ie:

aab*532*.3*-fox^
aaac*53268*.598*-car^

I am trying to find the text to the left of the "^" and to the right of the first "*" or to the right of the second "*" to the "^".

End results would need to be:

-fox
-car

Ingolf
01-06-2016, 09:32 PM
Hi,

Give us more examples.
With given examples, use one of the following formulas:

=SUBSTITUTE(RIGHT(A1,LEN(A1)-FIND("-",A1)+1),"^","")
or
=SUBSTITUTE(RIGHT(A1,5),"^","")

briguy22
01-06-2016, 09:57 PM
Hi,

Give us more examples.
With given examples, use one of the following formulas:

=SUBSTITUTE(RIGHT(A1,LEN(A1)-FIND("-",A1)+1),"^","")
or
=SUBSTITUTE(RIGHT(A1,5),"^","")


aab*532*.3*apple^
aaac*53268*.598*-car^
george*ford*678*banana^
rifle*car*.705*@exclamation^

results would need to be:

apple
-car
banana
@exclamation

Ingolf
01-06-2016, 11:34 PM
OK.

Try this formula:

=SUBSTITUTE(TRIM(RIGHT(SUBSTITUTE(A1,"*",REPT(" ",50)),30)),"^","")

or

=TRIM(RIGHT(SUBSTITUTE(SUBSTITUTE(A1,"^",""),"*",REPT(" ",50)),30))

briguy22
01-07-2016, 01:45 AM
This works for this example. What would I do if I had a data set that contained more *'s or if there is information after the ^ that I do not want to keep:

aab*532*.3*apple^ROCK
aaac*53268*.598*-car^PAPER
george*ford*678*banana^CAR
rifle*car*.705*@exclamation^12345

results would need to be:

apple
-car
banana
@exclamation

Ingolf
01-07-2016, 03:18 AM
First you would have to say thank you to that / those who tried to help.
If I come up with another formula, you will have to come up with other examples and you'll say, but if ...
It was hard, at first, come with significant examples?

Rick Rothstein
01-18-2016, 08:49 PM
This works for this example. What would I do if I had a data set that contained more *'s or if there is information after the ^ that I do not want to keep:

aab*532*.3*apple^ROCK
aaac*53268*.598*-car^PAPER
george*ford*678*banana^CAR
rifle*car*.705*@exclamation^12345

results would need to be:

apple
-car
banana
@exclamation
Assuming the text in each cell will never be longer than 200 characters...

=TRIM(RIGHT(SUBSTITUTE(LEFT(A1,FIND("^",A1)-1),"*",REPT(" ",200)),200))