+ Reply to Thread
Results 1 to 4 of 4

Extract a list of codes from data

  1. #1
    Registered User
    Join Date
    04-08-2009
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    85

    Extract a list of codes from data

    I've got data such as the following:

    Resources Nl Materials0.0000ACSC:\Stocks\All Acrux Limited Pharmaceuticals0.0000ACRC:\Stocks\All Adamus Resources Limited Materials-2.5317ADUC:\Stocks\All Adelaide Brighton Limited Materials2.4242ABCC:\Stocks\All Aditya Birla Minerals Limited Materials1.1236ABYC:\Stocks\All Advanced Braking Technolo Automobile & Co3.5714ABVC:\Stocks\All Advanced....

    and I want to extract a list of the three-letter alphabetic codes which appear directly to the left of every 'C:\' symbol - anyone know a formula or VBA code which could do this please? Thanks in advance.
    Last edited by jp001; 03-06-2011 at 04:02 AM.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Extract a list of codes from data

    Assuming the string in cell A1...

    1st code: =MID(A1, FIND("C:\", A1)-3, 3)
    2nd code: =MID(A1, FIND("||", SUBSTITUTE(A1,"C:\","||",2))-3,3)
    3rd code: =MID(A1, FIND("||", SUBSTITUTE(A1,"C:\","||",3))-3,3)
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Extract a list of codes from data

    If on the off chance you wanted a single delimited list then you could use a User Defined Function, eg:

    Please Login or Register  to view this content.
    the above, stored in a standard module, would be called from a cell along the lines of:

    Please Login or Register  to view this content.
    where A1 holds the string - the range you pass can encompass multiple cells (though it is assumed any multi cell range would be contiguous)

  4. #4
    Registered User
    Join Date
    04-08-2009
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    85

    Re: Extract a list of codes from data

    Thanks very much!

+ 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