+ Reply to Thread
Results 1 to 7 of 7

Finding and Extracting Expected set of characters from a cell

  1. #1
    Registered User
    Join Date
    04-21-2017
    Location
    London, England
    MS-Off Ver
    Office 2013
    Posts
    3

    Red face Finding and Extracting Expected set of characters from a cell

    Hi.

    I hope somebody might be able to help.

    I have a spreadsheet which contains product descriptions. Some of which include some product codes which I wish to extract into a different column. I've hunted high and low and got myself in a muddle, so came here for help.

    An example of a cell:
    200 Sheet Probe Wipes (130 x 130mm) (B81010043)

    The product code is B81010043 which is what I need to extract and place in a new cell. It will ALWAYS start with a B and it will ALWAYS be followed by 8 numbers. (So lowest code would be B10000000 and highest number would be B99999999)

    Does anybody know of a way to do this with a formula ?

    Many thanks in advance.

  2. #2
    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,471

    Re: Finding and Extracting Expected set of characters from a cell

    Welcome to the forum!

    Will it ALWAYS be in parenthesis and will it ALWAYS be at the end of the string? If the answer to either of these is "no", you need to provide more examples.
    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.

  3. #3
    Registered User
    Join Date
    04-21-2017
    Location
    London, England
    MS-Off Ver
    Office 2013
    Posts
    3

    Re: Finding and Extracting Expected set of characters from a cell

    Thanks for your reply.

    No, it seems to be anywhere in the cell and not always in parenthesis.. Another example here:-

    2 Ply White V Fold - Packed 4800 - B11120012 - HTINT3

    So here the code B11120012 is in the middle of the text.

    Some at the beginning:-

    B12100029 - Red Microfibre Cloth 40 x 40cm Packed 5 x 40 200gsm


    Thanks

  4. #4
    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,471

    Re: Finding and Extracting Expected set of characters from a cell

    OK - give us ten lines of data with as many different variations as you can, then someone can offer a suggestion that they've been able to test.

    Will you please attach a sample Excel workbook?

    1. Make sure that your sample data are REPRESENTATIVE of your real data. The use of unrepresentative data is very frustrating and can lead to long delays in reaching a solution.

    2. Make sure that your desired solution is also shown (mock up the results manually).

    3. Make sure that all confidential data is removed or replaced with dummy data first (e.g. names, addresses, E-mails, etc.).

    4. Try to avoid using merged cells as they cause lots of problems.

    Unfortunately the attachment icon doesn't work at the moment, so to attach an Excel file you have to do the following: just before posting, scroll down to Go Advanced and then scroll down to Manage Attachments. Now follow the instructions at the top of that screen.

    Please pay particular attention to point 2 (above): without an idea of your intended outcomes, it is often very difficult to offer appropriate advice.

  5. #5
    Forum Guru
    Join Date
    02-27-2016
    Location
    Vietnam
    MS-Off Ver
    2016
    Posts
    5,901

    Re: Finding and Extracting Expected set of characters from a cell

    Try this ...

    =IFERROR("B"&LOOKUP(2,1/(MID(A1,ROW(INDIRECT("1:"&LEN(A1)-8)),1)="B")
    /MID(A1,ROW(INDIRECT("2:"&LEN(A1)-7)),8),MID(A1,ROW(INDIRECT("2:"&LEN(A1)-7)),8)),"")
    Last edited by Phuocam; 04-21-2017 at 08:15 AM.

  6. #6
    Registered User
    Join Date
    04-21-2017
    Location
    London, England
    MS-Off Ver
    Office 2013
    Posts
    3

    Re: Finding and Extracting Expected set of characters from a cell

    Quote Originally Posted by Phuocam View Post
    Try this ...

    =IFERROR("B"&LOOKUP(2,1/(MID(A1,ROW(INDIRECT("1:"&LEN(A1)-8)),1)="B")
    /MID(A1,ROW(INDIRECT("2:"&LEN(A1)-7)),8),MID(A1,ROW(INDIRECT("2:"&LEN(A1)-7)),8)),"")
    Perfect !! Thank you so much Phuocam

    Works spot on.. Appreciate your help.

  7. #7
    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,471

    Re: Finding and Extracting Expected set of characters from a cell

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

+ 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: 6
    Last Post: 05-11-2015, 10:25 AM
  2. [SOLVED] Help Needed extracting last two characters to another cell
    By xtraman88 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 12-19-2013, 10:14 AM
  3. Extracting last characters from a cell.
    By davidx in forum Excel General
    Replies: 5
    Last Post: 06-11-2013, 06:53 PM
  4. [SOLVED] Extracting out last 5 characters from a cell/column of SKUs
    By ac14461 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 08-10-2012, 01:02 PM
  5. Extracting numeric characters only from a cell
    By NJS1982 in forum Excel General
    Replies: 3
    Last Post: 05-01-2012, 06:08 AM
  6. Finding characters in a cell
    By therealjag in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-10-2009, 04:20 AM
  7. [SOLVED] Extracting last 5 characters from a cell
    By colleen Curley in forum Excel General
    Replies: 2
    Last Post: 06-23-2005, 10:05 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