+ Reply to Thread
Results 1 to 6 of 6

Extract a text between 2 characters

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    05-20-2016
    Location
    Detroit
    MS-Off Ver
    Office 365 Version 2008 (July 2020)
    Posts
    819

    Extract a text between 2 characters

    I have to extract a text from String, between "-" and "x"
    But "-" I need to find from left side and "x" I need to find it from right side
    In another words : between First "-" from left side and First "x" from right side
    Last edited by AliGW; 01-17-2020 at 05:41 PM.

  2. #2
    Forum Expert Ace_XL's Avatar
    Join Date
    06-04-2012
    Location
    UAE
    MS-Off Ver
    2016
    Posts
    6,074

    Re: Extract a text between 2 characters !

    A bit long-wounded but try this

    =TRIM(RIGHT(SUBSTITUTE(TRIM(LEFT(SUBSTITUTE(A1,"x",REPT(" ",255),LEN(A1)-LEN(SUBSTITUTE(A1,"x",""))),255)),"-",REPT(" ",255)),255))
    Life's a spreadsheet, Excel!
    Say thanks, Click *

  3. #3
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Extract a text between 2 characters !

    Or this:

    Formula: copy to clipboard
    =TRIM(MID(SUBSTITUTE(SUBSTITUTE(A1,"x","-"),"-",REPT(" ",255)),255,255))

    v A B
    1 But "-" I need to find from left side and "x" I need to find it from right side " I need to find from left side and "
    2 In another words : between First "-" from left side and First "x" from right side " from left side and First "
    If you like my answer please click on * Add Reputation
    Don't forget to mark threads as "Solved" if your problem has been resolved

    "Nothing is so firmly believed as what we least know."
    --Michel de Montaigne

  4. #4
    Forum Contributor
    Join Date
    05-20-2016
    Location
    Detroit
    MS-Off Ver
    Office 365 Version 2008 (July 2020)
    Posts
    819

    Re: Extract a text between 2 characters

    For some reason, none of formulas above, works !
    I need to extract between First Left "-" and First Right "x"
    Regardless how many "-" or "x" are in string...

  5. #5
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 365 version 2501
    Posts
    18,933

    Re: Extract a text between 2 characters

    It may help if you provide an instance where the formulas don't work so that we can attempt modification.
    Let us know if you have any questions.
    Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.

  6. #6
    Valued Forum Contributor PaulSP8's Avatar
    Join Date
    11-21-2017
    Location
    Chorley, England
    MS-Off Ver
    2013 & 2021
    Posts
    437

    Re: Extract a text between 2 characters

    Try this;

    Formula: copy to clipboard
    =SUBSTITUTE(MID(A1,FIND("-",A1,1)+1,FIND("x",A1,1)+1),RIGHT(A1,LEN(A1)-FIND("x",A1,1)+1),"")

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Extract text between two characters
    By bhenlee in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 07-03-2018, 10:22 AM
  2. Extract text between certain characters
    By spiphix in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-08-2016, 05:19 PM
  3. [SOLVED] Extract certain text dependant on number of characters in text
    By bjoanmark in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 11-28-2014, 02:57 AM
  4. Extract text between two characters in a string - varing text length
    By luv2birdie in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 11-04-2014, 06:10 PM
  5. [SOLVED] Extract 50 characters text to a new worksheet
    By skyflare in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-02-2013, 01:44 AM
  6. Extract Text characters only from a cell
    By judasdac in forum Excel General
    Replies: 2
    Last Post: 05-06-2009, 12:22 PM
  7. extract text separated by characters
    By RANDYC1152 in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 04-25-2009, 09:54 PM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1