+ Reply to Thread
Results 1 to 6 of 6

VBA code to search for a word and return the values of numerous corresponding cells.

  1. #1
    Registered User
    Join Date
    01-19-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    23

    VBA code to search for a word and return the values of numerous corresponding cells.

    Hello, I am new to this forum, and am just starting to get involved heavily in Excel (business functions).
    I am looking for VBA code to search a worksheet for a specific word, and then return corresponding values next to that text. I have attached a sample. I am new to VBA, and tried to google/search the coding, but to no avail. Please see the attached spreadsheet, I have added notes in it.
    Thank you in advance.
    Attached Files Attached Files

  2. #2
    Forum Guru tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: VBA code to search for a word and return the values of numerous corresponding cel

    Schwartz,

    Welcome to the forum!
    Attached is a modified version of your example workbook. In 'MTD Variance'!A3 is the following array formula. Array formulas need to be entered with Ctrl+Shift+Enter and not just Enter. It is then copied over and down to cell F12:
    Please Login or Register  to view this content.


    If you require a VBA solution instead, let me know.
    Attached Files Attached Files
    Hope that helps,
    ~tigeravatar

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  3. #3
    Registered User
    Join Date
    01-19-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    23

    Re: VBA code to search for a word and return the values of numerous corresponding cel

    Thank you very much for your fast reply. That appears to be an easier solution than some VBA coding. It is funny, because I had originally tried a similar approach with Arrays, and failed. Thanks again!

  4. #4
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    4,248

    Re: VBA code to search for a word and return the values of numerous corresponding cel

    But then, if at any time you want to use code, this might work.
    Native Excel formulas are better though.
    Attached Files Attached Files

  5. #5
    Forum Guru mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,206

    Re: VBA code to search for a word and return the values of numerous corresponding cel

    You could use a Pivot Table, no VBA.
    Attached Files Attached Files
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

  6. #6
    Registered User
    Join Date
    01-19-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    23

    Re: VBA code to search for a word and return the values of numerous corresponding cel

    Thank you for all the assistance! It is great to have knowledgeable people. I like the variety of responses, I will try them and see which one makes the most sense. Thanks again!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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