+ Reply to Thread
Results 1 to 12 of 12

Loop through Auto Filter Criteria and Copy Formula Results Into New Sheet

  1. #1
    Forum Contributor
    Join Date
    05-24-2012
    Location
    Nashville, TN
    MS-Off Ver
    Excel 2007
    Posts
    113

    Loop through Auto Filter Criteria and Copy Formula Results Into New Sheet

    I have a worksheet that contains 3 columns, A, B, C, that I need to run through auto-filter and copy the results from a cell, F2, into another sheet each time the filter criteria changes.


    As an example, here is how I would envision this working for Col C:
    1. Starting on the 1st Sheet (named "FW15"), I auto-filter Col C on criteria/value 1
    2. I copy the resulting value from Cell F2 of sheet FW15 and paste it into the first empty cell of Col C in Sheet 2 (named "CopiedResults")
    3. I return to my first sheet, FW15, turn off the enabled filter for criteria/value (1), and turn on the next autofilter Criteria/Value (of 2)
    4. Repeat Step 2
    .
    .
    Keep looping through Autofilter criteria in Col C, and copy each resulting value contained in Cell F2 over to the second sheet.

    Likewise, I would need to run through the auto-filter criteria in Col A and Col B, and copy their resulting values (from cell F2) into Sheet2 Col A and Col B.

    Really stuck on how to loop and copy the resulting values, and would greatly appreciate some help on this.
    Attached Files Attached Files
    Last edited by hamidxa; 05-21-2014 at 09:40 AM. Reason: For Clarity

  2. #2
    Forum Contributor
    Join Date
    05-24-2012
    Location
    Nashville, TN
    MS-Off Ver
    Excel 2007
    Posts
    113

    Re: Loop through Auto Filter Criteria and Copy Formula Results Into New Sheet

    Bumped and post edited for clarity.
    As always, would greatly appreciate any assistance offered.

    Thanks in advance!

  3. #3
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Loop through Auto Filter Criteria and Copy Formula Results Into New Sheet

    Hi hamidxa

    This is my perception of what you're looking for
    Please Login or Register  to view this content.
    Attached Files Attached Files
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  4. #4
    Forum Contributor
    Join Date
    05-24-2012
    Location
    Nashville, TN
    MS-Off Ver
    Excel 2007
    Posts
    113

    Re: Loop through Auto Filter Criteria and Copy Formula Results Into New Sheet

    Jaslake,

    Thank you for taking a stab at this.
    The results that were copied did not however come out as I had hoped.

    Would there be a way to generate something like this, for example, if I filter against all of the criteria in Col B, to copy the corresponding cell F2 values for each B criteria:
    Real examples from worksheet:

    If I filter on B = 11, F2 = 0.59163
    If I filter on B = 12, F2 = 0.93764
    If I filter on B = 13, F2 = 1.09873

    So on and so forth.

    I would love to be able to see a second sheet (CopiedResults) that has results like the above example for Cols A, B, and C.

    So basically the results sheet would look like this image (these are the actual values I obtain when filtering on each of the columns):
    Capture.JPG

  5. #5
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Loop through Auto Filter Criteria and Copy Formula Results Into New Sheet

    Hi hamidxa

    I see...the results I was getting made no sense to me.

    Let me take another stab at it...get back to you...

    Do you want the Results Sheet to look like the Image you posted?
    Last edited by jaslake; 05-21-2014 at 02:00 PM.

  6. #6
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Loop through Auto Filter Criteria and Copy Formula Results Into New Sheet

    Hi hamidxa

    See if this works better for you...
    Please Login or Register  to view this content.
    Attached Files Attached Files

  7. #7
    Forum Contributor
    Join Date
    05-24-2012
    Location
    Nashville, TN
    MS-Off Ver
    Excel 2007
    Posts
    113

    Re: Loop through Auto Filter Criteria and Copy Formula Results Into New Sheet

    jaslake,

    Woah, that's brilliant!

    I hate to almost ask this, but what if I wanted to enable the filter in Column I to always read "Compliant" as its criteria through each iteration of these loops.
    Last edited by hamidxa; 05-21-2014 at 03:57 PM.

  8. #8
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Loop through Auto Filter Criteria and Copy Formula Results Into New Sheet

    Hi hamidxa

    How about showing me samples of your anticipated results...several for A, B and C.

  9. #9
    Forum Contributor
    Join Date
    05-24-2012
    Location
    Nashville, TN
    MS-Off Ver
    Excel 2007
    Posts
    113

    Re: Loop through Auto Filter Criteria and Copy Formula Results Into New Sheet

    Quote Originally Posted by jaslake View Post
    Hi hamidxa

    How about showing me samples of your anticipated results...several for A, B and C.
    Here you go.
    Capture2.JPG

    Thanks in advance, again.

  10. #10
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Loop through Auto Filter Criteria and Copy Formula Results Into New Sheet

    Hi hamidxa

    Replace the Code with this
    Please Login or Register  to view this content.

  11. #11
    Forum Contributor
    Join Date
    05-24-2012
    Location
    Nashville, TN
    MS-Off Ver
    Excel 2007
    Posts
    113

    Re: Loop through Auto Filter Criteria and Copy Formula Results Into New Sheet

    jaslake,

    Truly grateful for all of your brilliance and consideration.
    This is simply awesome.
    Can't explain all of it, but i'll walk through the code and try to sort things out on my own at some point, but I definitely can see what you did there with the added criteria request.

    Again, a huge thank you!

  12. #12
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Loop through Auto Filter Criteria and Copy Formula Results Into New Sheet

    You're welcome...glad I could help. Thanks for the Rep.

    If this resolves your issue please mark your Thread as SOLVED.

    New quick method:
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

    Or you can use this way:
    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click SaveYou're welcome...glad I could help.

+ 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. [SOLVED] Run a loop to slected data then filter on another sheet and copy to another sheet
    By af_lel in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-21-2013, 07:10 AM
  2. [SOLVED] Filter a sheet and copy results to another sheet
    By dixiV in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-04-2012, 10:21 AM
  3. Filter a sheet and copy results to another sheet
    By dixiV in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-03-2012, 06:35 AM
  4. Auto filter data and copy results to another worksheet?
    By thisiscrazy in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 04-24-2012, 07:46 AM
  5. Replies: 2
    Last Post: 06-28-2011, 10:19 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