+ Reply to Thread
Results 1 to 6 of 6

Extracting data from a string

  1. #1
    Registered User
    Join Date
    02-28-2012
    Location
    UK
    MS-Off Ver
    Excel 2007
    Posts
    3

    Extracting data from a string

    Using "BACARDI SINGLE 000000000000000148" as an example, could someone give me the code in Excel 2007 to extract "BACARDI SINGLE" from the string. I'm looking to extract any information to the left of the 8 spaces.

    Thanks

  2. #2
    Forum Expert DGagnon's Avatar
    Join Date
    02-23-2012
    Location
    Ontario, Canada
    MS-Off Ver
    Excel 2003, 2007
    Posts
    1,645

    Re: Extracting data from a string

    i cant see 8 spaces in your example, probably due to formating, but try
    Please Login or Register  to view this content.
    Last edited by DGagnon; 02-28-2012 at 08:44 PM.
    If you liked my solution, please click on the Star -- to add to my reputation

    If your issue as been resolved, please clearly state so and mark the thread as [SOLVED] using the thread tools just above the first post.

  3. #3
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    25,408

    Re: Extracting data from a string

    Quote Originally Posted by Robz19 View Post
    Using "BACARDI SINGLE 000000000000000148" as an example, could someone give me the code in Excel 2007 to extract "BACARDI SINGLE" from the string. I'm looking to extract any information to the left of the 8 spaces.

    Thanks
    The 8 spaces do not show up on the forum, though I can see them by quoting your post.

    You can do this:

    =LEFT(A1,SEARCH("........",A1)-1)
    I've put quote tags around the formula so the spaces will not be trimmed.

    Hope this helps.

    Pete

    EDIT: even that didn't stop them from disappearing, so I've put full-stops in instead - use spaces in your workbook.

    Pete

  4. #4
    Registered User
    Join Date
    02-28-2012
    Location
    UK
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Extracting data from a string

    The 8 spaces are between the word SINGLE and the numeric. I have tried that, but return a #VALUE! error.

  5. #5
    Forum Expert DGagnon's Avatar
    Join Date
    02-23-2012
    Location
    Ontario, Canada
    MS-Off Ver
    Excel 2003, 2007
    Posts
    1,645

    Re: Extracting data from a string

    can you privde a few lines of samples in an excel workbook format?

  6. #6
    Registered User
    Join Date
    02-28-2012
    Location
    UK
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Extracting data from a string

    Fabulous. Thank you Pete.

+ 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