Results 1 to 7 of 7

Thread: Pull text from the left of a character to the right of the next character foun

  1. #1
    Junior Member
    Join Date
    Jan 2016
    Posts
    3
    Rep Power
    0

    Pull text from the left of a character to the right of the next character foun

    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

  2. #2
    Member
    Join Date
    Jul 2012
    Posts
    55
    Rep Power
    13
    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),"^","")

  3. #3
    Junior Member
    Join Date
    Jan 2016
    Posts
    3
    Rep Power
    0
    Quote Originally Posted by Ingolf View Post
    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

  4. #4
    Member
    Join Date
    Jul 2012
    Posts
    55
    Rep Power
    13
    OK.

    Try this formula:

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

    or

    =TRIM(RIGHT(SUBSTITUTE(SUBSTITUTE(A1,"^",""),"*",R EPT(" ",50)),30))
    Last edited by Ingolf; 01-07-2016 at 12:50 AM.

  5. #5
    Junior Member
    Join Date
    Jan 2016
    Posts
    3
    Rep Power
    0
    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
    Last edited by briguy22; 01-07-2016 at 01:51 AM.

  6. #6
    Member
    Join Date
    Jul 2012
    Posts
    55
    Rep Power
    13
    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?
    Last edited by Ingolf; 01-07-2016 at 03:20 AM.

  7. #7
    Forum Guru Rick Rothstein's Avatar
    Join Date
    Feb 2012
    Posts
    662
    Rep Power
    13
    Quote Originally Posted by briguy22 View Post
    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))

Similar Threads

  1. Replies: 4
    Last Post: 08-11-2015, 02:14 PM
  2. Macro To Delete Numbers With Trailing Character
    By Howardc in forum Excel Help
    Replies: 8
    Last Post: 04-05-2013, 08:14 PM
  3. Left and Right Mouse Click Event
    By PcMax in forum Excel Help
    Replies: 10
    Last Post: 11-24-2012, 04:54 AM
  4. Count words having more than one character in a cell
    By Admin in forum Excel and VBA Tips and Tricks
    Replies: 3
    Last Post: 03-13-2012, 08:29 PM
  5. Replies: 2
    Last Post: 02-29-2012, 08:24 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •