+ Reply to Thread
Results 1 to 11 of 11

Extract data from String, between Beginning and "-" with criteria "/"

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

    Extract data from String, between Beginning and "-" with criteria "/"

    In attached at C2, I want to extract data from A:A, between Beginning and "-" with criteria : all which contain "/" , in consecutive order
    Attached Files Attached Files

  2. #2
    Forum Expert KOKOSEK's Avatar
    Join Date
    08-03-2018
    Location
    Pole in Yorkshire, UK
    MS-Off Ver
    365/2013
    Posts
    2,765

    Re: Extract data from String, between Beginning and "-" with criteria "/"

    Is it correct?


    A
    B
    C
    1
    Name
    Name
    2
    Text2 AK123/007
    3
    AK123/007-Text3 12345/001
    4
    12345/001-Text4 114477/135
    5
    114477/135-Text5 2345/033
    6
    Text6
    7
    2345/033-Text6


    I am sure that it can be solved easier but it works (if you got lost of rows with data, I suggest to consider some vba UDF).


    A
    B
    C
    1
    Name
    Name
    2
    Text2 =IFERROR(TRIM(LEFT(INDEX($A:$A,SMALL(IF(IFERROR(FIND("/",$A$2:$A$7),0),ROW($A$2:$A$7),10^10),ROW()-1)),FIND("-",INDEX($A:$A,SMALL(IF(IFERROR(FIND("/",$A$2:$A$7),0),ROW($A$2:$A$7),10^10),ROW()-1)))-1)),"")


    Formula in C2 is array type so it have to be accept with Shift+Ctrl+Enter (not just Enter as usual).
    Happy with my answer * Add Reputation.
    If You are happy with solution, please use Thread tools and mark thread as SOLVED.

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

    Re: Extract data from String, between Beginning and "-" with criteria "/"

    yes, but with no TRIM, and I got it !
    Thanks !
    Last edited by ionelz; 03-25-2020 at 11:53 AM.

  4. #4
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,327

    Re: Extract data from String, between Beginning and "-" with criteria "/"

    =IFERROR(LEFT(INDEX($A:$A,SMALL(IF(IFERROR(FIND("/",$A$2:$A$7),0),ROW($A$2:$A$7),10^10),ROW()-1)),FIND("-",INDEX($A:$A,SMALL(IF(IFERROR(FIND("/",$A$2:$A$7),0),ROW($A$2:$A$7),10^10),ROW()-1)))-1),"")

    Trim removed
    HTH
    Regards, Jeff

  5. #5
    Forum Expert KOKOSEK's Avatar
    Join Date
    08-03-2018
    Location
    Pole in Yorkshire, UK
    MS-Off Ver
    365/2013
    Posts
    2,765

    Re: Extract data from String, between Beginning and "-" with criteria "/"

    Just to avoid leading spaces. Removed it if leading spaces are important.

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

    Re: Extract data from String, between Beginning and "-" with criteria "/"

    Works, Thank you

  7. #7
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,327

    Re: Extract data from String, between Beginning and "-" with criteria "/"

    You are very welcome. We are happy to help and thanks for the feedback.

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

    Also, as a relatively new member of the forum, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.

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

    Re: Extract data from String, between Beginning and "-" with criteria "/"

    If I move start location
    A from A1 to A5 down
    C from C2 to C4, how formula would change ?
    not sure where to change rows
    Last edited by ionelz; 03-25-2020 at 01:02 PM.

  9. #9
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,327

    Re: Extract data from String, between Beginning and "-" with criteria "/"

    Try

    =IFERROR(LEFT(INDEX($A:$A,SMALL(IF(IFERROR(FIND("/",$A$2:$A$7),0),ROW($A$2:$A$7),10^10),ROW())),FIND("-",INDEX($A:$A,SMALL(IF(IFERROR(FIND("/",$A$2:$A$7),0),ROW($A$2:$A$7),10^10),ROW())))-1),"")

  10. #10
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,327

    Re: Extract data from String, between Beginning and "-" with criteria "/"

    Hi ionelz,

    Please stop updating your post after you've been given an answer. This is twice now and every time my answer had to be updated to correct what you changed.

    Please think about what you want and then post an updated workbook with a clear before and after and your actual setup.

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

    Re: Extract data from String, between Beginning and "-" with criteria "/"

    All good ! Your answer is correct and I will keep that !
    I did not expect such an fast answer, that why I updated !

+ 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. Replies: 5
    Last Post: 02-05-2019, 12:03 AM
  2. Replies: 2
    Last Post: 07-24-2017, 02:19 AM
  3. [SOLVED] Column X-Ref list - Sheet1 Col A "pages", Col B:FL "Req" to Sheet2 ColA "req", ColB "page"
    By excel-card-pulled in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 04-07-2017, 09:30 AM
  4. Replies: 1
    Last Post: 08-15-2014, 06:00 AM
  5. Replies: 4
    Last Post: 11-17-2013, 12:05 PM
  6. [SOLVED] How to USE """"" cells count """"" change font color
    By austin123456 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-09-2013, 06:14 AM
  7. Replies: 5
    Last Post: 09-19-2008, 04:02 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