+ Reply to Thread
Results 1 to 9 of 9

Extracting info between 2 symbols in one cell

  1. #1
    Registered User
    Join Date
    10-04-2017
    Location
    Dublin
    MS-Off Ver
    Microsoft 365 Apps for Enterprise
    Posts
    34

    Extracting info between 2 symbols in one cell

    I'm stuck and need Excel GURU help!

    I have thousands of stock codes I need to be able to extract certain info from code. Codes can be different in lenght, so Left and Right formula doesn't work...

    Stock code format is as follows: AA/BBB/123/PP/XY02 - most important here are "/" - they are used as dividers of different type of info about the product. The length of characters in between can vary.

    I need to extract the "123" - it is always between 2nd and 3rd "/".

    Is there is an easy solution to this?

    Thank you so much for your help in advance

  2. #2
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,458

    Re: Extracting info between 2 symbols in one cell

    Working with cell A1:
    Please Login or Register  to view this content.
    give "123" in text format
    Formula+0 to get 123 as value
    Quang PT

  3. #3
    Forum Expert
    Join Date
    03-28-2014
    Location
    Hyderabad,India
    MS-Off Ver
    Excel 2013
    Posts
    1,887

    Re: Extracting info between 2 symbols in one cell

    Formula: copy to clipboard
    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    10-04-2017
    Location
    Dublin
    MS-Off Ver
    Microsoft 365 Apps for Enterprise
    Posts
    34

    Re: Extracting info between 2 symbols in one cell

    Hi All,

    Here I'm back now looking for more help. bebo021999 suggestion to use =TRIM(MID(SUBSTITUTE(A1,"/",REPT(" ",1000)),2000,1000)) works brilliantly! but now I need to extract the 4th part of code (between 3rd and 4th "/") eg. code AA/BBB/123/PP/XY02 and I need to extract "PP" from it. How to alternate the formula to get this answer?

    Thank you so much!

  5. #5
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,416

    Re: Extracting info between 2 symbols in one cell

    Third segment = 3000:

    =TRIM(MID(SUBSTITUTE(A1,"/",REPT(" ",1000)),3000,1000))
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  6. #6
    Registered User
    Join Date
    10-04-2017
    Location
    Dublin
    MS-Off Ver
    Microsoft 365 Apps for Enterprise
    Posts
    34

    Re: Extracting info between 2 symbols in one cell

    AliGW Brilliant! Thank you so much!

  7. #7
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,811

    Re: Extracting info between 2 symbols in one cell

    I will throw this into the mix -- just in case you are not limited to Excel for this. I think Google Sheets SPLIT() function makes easy work of problems like this. =SPLIT(A1,"/") entered in a cell (Sheets has a similar Spill feature to the newest versions of Excel) will separate each part of the text string into a separate cell. Or you can nest that inside of an INDEX() function to get a single value =INDEX(SPLIT(A1,"/"),3) will extract the 3rd element from the text string/array. =INDEX(SPLIT(A1,"/"),B1) will allow you to enter 3 or 4 or whatever into B1 and the formula will output the corresponding element from the text/array.

    Note that the SPLIT() function is currently only supported by Google Sheets.

    Also note that this function is very similar to the VBA Split() function, and I have seen some propose a VBA UDF (in an add-in) that makes this function available to Excel.

    These TRIM(MID(SUBSTITUTE(...)...) type function also work, but I find them less easily understood, which makes them more difficult to edit or modify when one needs something different. The SPLIT() function that converts a delimited text string into an array makes more sense to me, so I find it easier to work with.

    For whatever little it is worth.
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  8. #8
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,416

    Re: Extracting info between 2 symbols in one cell

    Quote Originally Posted by ELFIJKA View Post
    AliGW Brilliant! Thank you so much!
    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

    Also, 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.

  9. #9
    Registered User
    Join Date
    10-04-2017
    Location
    Dublin
    MS-Off Ver
    Microsoft 365 Apps for Enterprise
    Posts
    34

    Re: Extracting info between 2 symbols in one cell

    I completely agree and I don't understand why Microsoft still hasn't included SPLIT formula as standard... but for now I'll keep using TRIM(MID(SUBSTITUTE(...)...) as we are in MS Office and I need to get it working...

    Thanks a lot for sharing!

+ 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] Extracting info from cell
    By L.LEE in forum Excel General
    Replies: 3
    Last Post: 11-03-2017, 02:23 AM
  2. [SOLVED] extracting info from one cell based on info from other cells
    By maximelling in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 02-16-2017, 04:11 AM
  3. Extracting info from cell
    By viber52 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 06-23-2015, 09:42 PM
  4. Help with extracting info from a cell
    By AceForSale in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-28-2015, 04:57 PM
  5. Extracting Info from one cell into another
    By Jamielynn05 in forum Excel General
    Replies: 2
    Last Post: 08-14-2012, 12:57 PM
  6. Extracting info from cell
    By SOS in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 06-20-2008, 06:34 PM
  7. Extracting correct info from cell
    By Psy6 in forum Excel General
    Replies: 3
    Last Post: 05-27-2008, 05:30 AM

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