+ Reply to Thread
Results 1 to 10 of 10

For loop to return multiple values from another worksheet

  1. #1
    Registered User
    Join Date
    09-15-2014
    Location
    Seattle
    MS-Off Ver
    2007
    Posts
    9

    For loop to return multiple values from another worksheet

    I'm having trouble coming up with a solution to my problem..I need to look up a specific Value in Cell "D1" in Worksheet 1, and return all the values that starts with the value in D1 in a data table pasted in column A in Worksheet 2.

  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: For loop to return multiple values from another worksheet

    Attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

    View Pic


    Basically, can you SHOW us the problem/need?
    _________________
    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 Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Re: For loop to return multiple values from another worksheet


    Activate Macro Recorder, do on Worksheet #2 a manual Find or better a filter and you will obtain a free new code !

    Post it here and ask for what's missing, to be continued …

  4. #4
    Registered User
    Join Date
    09-15-2014
    Location
    Seattle
    MS-Off Ver
    2007
    Posts
    9

    Re: For loop to return multiple values from another worksheet

    here's an example spreadsheet
    Attached Files Attached Files

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

    Re: For loop to return multiple values from another worksheet

    You don't really need VBA. This ARRAY formula in B4 should work:

    =IFERROR(INDEX(Sheet2!$A$1:$A$1000, SMALL(IF(ISNUMBER(SEARCH($D$1, Sheet2!$A$1:$A$1000)), ROW(Sheet2!$A$1:$A$1000),""), ROWS($A$1:$A1))), "")

    ...confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. You will know the array is active when you see curly braces { } appear around your formula. If you do not CTRL+SHIFT+ENTER you will get an error or a clearly incorrect answer. Press F2 on that cell and try again.

    Once the first value has correctly appeared and the array is active, copy B4 downward.

  6. #6
    Registered User
    Join Date
    09-15-2014
    Location
    Seattle
    MS-Off Ver
    2007
    Posts
    9

    Re: For loop to return multiple values from another worksheet

    it's almost working...i got values in B4 but i don't think it searched the specific value in D1 because its giving me everything from the other sheet

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

    Re: For loop to return multiple values from another worksheet

    Do you see the curly braces around the formula in B4?

    http://screencast.com/t/jMEKrG6aAy

  8. #8
    Registered User
    Join Date
    09-15-2014
    Location
    Seattle
    MS-Off Ver
    2007
    Posts
    9

    Re: For loop to return multiple values from another worksheet

    yes it is there

  9. #9
    Forum Expert Vikas_Gautam's Avatar
    Join Date
    06-04-2013
    Location
    Ludhiana,Punjab, India
    MS-Off Ver
    Excel 2013
    Posts
    1,850

    Re: For loop to return multiple values from another worksheet

    You can try the Attached file..
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Regards,
    Vikas Gautam
    Excel-buzz.blogspot.com

    Excel is not a matter of Experience, its a matter of Application.

    Say Thanks, Click * Add Reputation

  10. #10
    Registered User
    Join Date
    09-15-2014
    Location
    Seattle
    MS-Off Ver
    2007
    Posts
    9

    Re: For loop to return multiple values from another worksheet

    awesome! thanks everyone!

+ 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. Return common values in multiple worksheets into one worksheet
    By haskenazi in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-06-2014, 10:10 PM
  2. Replies: 2
    Last Post: 10-14-2013, 05:37 PM
  3. Replies: 6
    Last Post: 03-06-2013, 03:30 PM
  4. Replies: 12
    Last Post: 06-03-2012, 11:02 PM
  5. Lookup cell value in separate worksheet and return multiple matched values
    By jwhite68 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 02-19-2007, 12:17 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