+ Reply to Thread
Results 1 to 2 of 2

Need help on String Extraction from a cell based on start string and end string

  1. #1
    Registered User
    Join Date
    08-07-2015
    Location
    india
    MS-Off Ver
    MS-OFfice 2013
    Posts
    2

    Need help on String Extraction from a cell based on start string and end string

    Team,

    I have 10000 lines in a particular Cell. Say "A1".

    In each and every row, i will do a search on a particular string and once it finds then it should go through the entire line of code in each row and extract it until it find the second string and extract it and store in a array and put them in a notepad file.

    1. Please see the following lines of code:-

    (case when ( ges.hlth_cov_cls_cd )= 'DG' and ges.src_sys_key = 203 then 'MEDICARE PART D'
    when ( ges.hlth_cov_cls_cd ) = 'DG' and ges.src_sys_key = 199 and substr(( ges.cov_serv_id ),1,2) = 'RM' then 'MO DUPLICATED DRUG'

    2. I will provide start string as "ges." and end string as "="

    3. I need to fetch the strings that starts with ges.. ie., ges.hlth_cov_cls_cd before the "=" symbol and it should navigate throw the next occurrance of the start of the keyword (ges.) i.e., ges.src_sys_key before the "=" . then the both the string ges.hlth_cov_cls_cd and ges.src_sys_key should be stored in a text file and if there is a provision to store them under Column B, that will be very helpful.

    Is this possible in VBA and if so, can i get the code and also i am new to VBA and request to provide end-to-end instructions to carry out the task.

    Regards,
    Premnath




    _

  2. #2
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,947

    Re: Need help on String Extraction from a cell based on start string and end string

    Set a reference to MS Scripting Runtime, and try code like this, which will find all strings that start with ges. and put them into cells starting with B1, the C1, then....

    Please Login or Register  to view this content.
    Bernie Deitrick
    Excel MVP 2000-2010

+ 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: 7
    Last Post: 04-15-2015, 09:32 AM
  2. [SOLVED] Script to Search for a specific String then return cell values above that String-2
    By owensjb2 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 04-01-2015, 01:00 PM
  3. Extract string based on specific string
    By YasserKhalil in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 12-15-2014, 12:16 AM
  4. Generating random number string based on Alphanumeric String
    By ridemeve in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 08-15-2014, 04:56 PM
  5. [SOLVED] VBA for searching string in a column and copy rows depending on string in adjacent cell
    By xprakash in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 10-20-2013, 05:58 AM
  6. [SOLVED] IF range of cells contains string of text, return contents of cell where string is found
    By nobodyukno in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 07-03-2013, 09:56 AM
  7. Replies: 8
    Last Post: 08-07-2012, 10:15 AM

Tags for this Thread

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