+ Reply to Thread
Results 1 to 7 of 7

Extracting numbers after a # in a text string

  1. #1
    Registered User
    Join Date
    07-26-2011
    Location
    New Zealand
    MS-Off Ver
    Excel 2007
    Posts
    43

    Extracting numbers after a # in a text string

    I need to be able to extract four numbers after a # in a text string.

    For example:
    Bought 3,544,000 shares of #0168 Air New Zealand
    Bought 3,750,000 shares of #0198 Microsoft
    Settled bought 1,970,000 shares of #0345 Google
    Scrip deposit 77,144,000 shares of #0178 IBM

    I need to be able to extract the 0198, 0345 and the 0178 into another cell.

    If anyone can help it would be appreciated.

    Also, if anyone can tell me how to extract the company name off the end of the string that would be great to.
    Last edited by percyth1; 08-23-2012 at 11:09 PM.

  2. #2
    Valued Forum Contributor
    Join Date
    09-07-2006
    Posts
    520

    Re: Extracting numbers after a # in a text string

    Here's a way,
    Assuming data as posted is running in A2 down
    eg in B2: =MID(A2,SEARCH("#",A2)+1,4)
    Copy down
    Last edited by Max, Singapore; 08-24-2012 at 02:06 AM.

  3. #3
    Registered User
    Join Date
    07-26-2011
    Location
    New Zealand
    MS-Off Ver
    Excel 2007
    Posts
    43

    Re: Extracting numbers after a # in a text string

    Wow, thanks that works!

  4. #4
    Forum Expert
    Join Date
    06-09-2010
    Location
    Australia
    MS-Off Ver
    Excel 2013
    Posts
    1,714

    Re: Extracting numbers after a # in a text string

    Hi

    if you select the range with your text, this macro will copy the number of shares into the cell to the right, and the name of the company in the cell to the right of that:

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    07-26-2011
    Location
    New Zealand
    MS-Off Ver
    Excel 2007
    Posts
    43

    Re: Extracting numbers after a # in a text string

    That also works nicely, thanks.

  6. #6
    Forum Moderator vlady's Avatar
    Join Date
    09-22-2011
    Location
    Philippines - OLSHCO -Guimba-Nueva Ecija
    MS-Off Ver
    2021
    Posts
    4,366

    Re: Extracting numbers after a # in a text string

    ***JUST if ever you have more than 4 numbers (static numbers)

    Please Login or Register  to view this content.
    I think people forget the word "THANK YOU!!!!" Do you still know it???

    There is a little star ( ADD REPUTATION ) below those person who helped you. Click it to say your "PRIVATE APPRECIATION TO THEIR EFFORT ON THEIR CONTRIBUTIONS "

    Regards,
    Vladimir

  7. #7
    Valued Forum Contributor
    Join Date
    09-07-2006
    Posts
    520

    Re: Extracting numbers after a # in a text string

    Glad to hear. You could express your satisfaction & happiness by clicking the little star at the bottom left of my response, cheers

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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