+ Reply to Thread
Results 1 to 8 of 8

Script to Search for a specific String then return cell values above that String

  1. #1
    Registered User
    Join Date
    05-08-2010
    Location
    AZ
    MS-Off Ver
    Excel 2007
    Posts
    49

    Script to Search for a specific String then return cell values above that String

    Hello,

    I am trying to figure out a way to comb through data and look for a specific string and show only what is in the cell above that string. The string will appear multiple times so the script needs to repeat to find every occurance.

    With the sample data attached, below would be the result:

    <Entity RecordID="28469234">
    <Entity RecordID="28469389">
    <Entity RecordID="28469687">
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    08-28-2014
    Location
    Texas, USA
    MS-Off Ver
    2016
    Posts
    1,796

    Re: Script to Search for a specific String then return cell values above that String

    You didn't specify how you wanted the output, so this just displays the results in a message box. Could easily be modified to put the results in another column, or sheet, or whatever.

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    05-08-2010
    Location
    AZ
    MS-Off Ver
    Excel 2007
    Posts
    49

    Re: Script to Search for a specific String then return cell values above that String

    Thanks for the quick response!

    Would it be possible to have the results replace the data currenlty in the sheet...If not I can just make an additional sheet to copy and paste the results?

  4. #4
    Forum Expert
    Join Date
    02-22-2013
    Location
    London, UK
    MS-Off Ver
    Office 365
    Posts
    1,218

    Re: Script to Search for a specific String then return cell values above that String

    Try:
    Please Login or Register  to view this content.
    HTH,
    berlan
    Last edited by berlan; 04-01-2015 at 10:50 AM.

  5. #5
    Forum Expert
    Join Date
    08-28-2014
    Location
    Texas, USA
    MS-Off Ver
    2016
    Posts
    1,796

    Re: Script to Search for a specific String then return cell values above that String

    Would it be possible to have the results replace the data currently in the sheet
    Please Login or Register  to view this content.

  6. #6
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Script to Search for a specific String then return cell values above that String

    Another - uses msgbox

    Please Login or Register  to view this content.
    Adding:

    Please Login or Register  to view this content.
    Will place the results in K1

  7. #7
    Registered User
    Join Date
    05-08-2010
    Location
    AZ
    MS-Off Ver
    Excel 2007
    Posts
    49

    Re: Script to Search for a specific String then return cell values above that String

    These have both worked great! Thank you both for you quick assistance!

  8. #8
    Valued Forum Contributor
    Join Date
    03-22-2013
    Location
    Australia,NSW, Wirrimbi
    MS-Off Ver
    Excel 2013
    Posts
    1,057

    Re: Script to Search for a specific String then return cell values above that String

    Maybe this too..

    Please Login or Register  to view this content.
    Edit: Second go..
    Last edited by apo; 04-01-2015 at 12:10 PM.

+ 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. Macro Script to return a cell values realted to a string
    By owensjb2 in forum Excel Programming / VBA / Macros
    Replies: 21
    Last Post: 03-26-2015, 09:27 AM
  2. [SOLVED] Search for a text string and return given text string to adjacent cell
    By hecgroups in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-14-2015, 04:50 AM
  3. VBA to search files within a folder for a specific string and return file name
    By tjej6987 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-03-2014, 12:41 PM
  4. Replies: 3
    Last Post: 10-03-2012, 03:09 AM
  5. Search column for string and return every row with that string in new sheet
    By myers601 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-03-2012, 06:02 PM

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